/* ShowUp — phone-first styles, inspired by Cohere's calm, editorial look */
:root {
  --primary: #17171c;
  --ink: #212121;
  --deep-green: #003c33;
  --navy: #071829;
  --canvas: #ffffff;
  --stone: #eeece7;
  --pale-green: #edfce9;
  --pale-blue: #f1f5ff;
  --hairline: #d9d9dd;
  --border: #e5e7eb;
  --muted: #93939f;
  --slate: #75758a;
  --body-muted: #616161;
  --blue: #1863dc;
  --focus: #4c6ee6;
  --coral: #ff7759;
  --coral-soft: #ffad9b;
  --error: #b30000;
  --green-ink: #0d6b3a;

  --r-xs: 4px; --r-sm: 8px; --r-md: 16px; --r-lg: 22px; --r-xl: 30px; --r-pill: 32px;
  --font: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--stone); color: var(--ink);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
body.no-scroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
code { font-family: var(--mono); font-size: .9em; background: var(--stone); padding: 1px 5px; border-radius: 4px; }
.hide { display: none !important; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.muted { color: var(--slate); }
.small { font-size: 14px; }
.micro { font-size: 12px; line-height: 1.4; }
.coral-text { color: #d24a2c !important; }

/* ---- type ---- */
.display { font-size: clamp(44px, 12vw, 80px); line-height: .98; letter-spacing: -0.03em; font-weight: 400; margin: 0 0 16px; }
.h1 { font-size: clamp(32px, 8vw, 44px); line-height: 1.05; letter-spacing: -0.02em; font-weight: 400; margin: 2px 0 20px; }
.h2 { font-size: clamp(26px, 6.5vw, 34px); line-height: 1.1; letter-spacing: -0.015em; font-weight: 400; margin: 4px 0 8px; }
.h3 { font-size: 21px; line-height: 1.25; letter-spacing: -0.01em; font-weight: 500; margin: 0; }
.h4 { font-size: 17px; line-height: 1.3; font-weight: 500; margin: 0; }
.lead { font-size: 18px; line-height: 1.45; color: rgba(255,255,255,.78); margin: 0 0 24px; max-width: 30ch; }
.mono-label {
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--slate); margin: 0 0 4px;
}
.mono-label.on-dark, .on-dark-muted { color: rgba(255,255,255,.66); }
.on-dark-muted { margin: 0 0 16px; }

/* ---- layout ---- */
.page { max-width: 640px; margin: 0 auto; padding: 8px 16px 40px; }
.page.narrow { max-width: 480px; padding-top: 40px; }
.center-fill { min-height: 70dvh; display: grid; place-items: center; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  max-width: 640px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
  background: rgba(238,236,231,.86); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.topbar-title { flex: 1; text-align: center; font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 17px; padding: 0 6px; min-height: 44px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--coral); box-shadow: 14px 0 0 -2px var(--deep-green); margin-right: 12px; }
.icon-btn {
  display: inline-grid; place-items: center; min-width: 44px; height: 44px;
  border: 0; background: transparent; border-radius: 50%; cursor: pointer;
}
.icon-btn:active { background: rgba(0,0,0,.06); }
.me-btn { padding: 0; }

/* ---- cards ---- */
.card {
  display: block; background: var(--canvas); border: 1px solid #f2f2f2;
  border-radius: var(--r-lg); margin-bottom: 12px; overflow: hidden;
}
.card.pad, .pad { padding: 20px; }
.card.band, .card.hero {
  background: var(--deep-green); color: #fff; border: 0; padding: 24px;
}
.card.hero { background: var(--primary); }
.card.band.center .btn { margin-top: 8px; }
.empty { text-align: center; }
.empty .btn { margin-top: 12px; }
.empty p { margin: 4px 0; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 4px 12px; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border: 1px solid var(--primary);
  border-radius: var(--r-pill); background: var(--primary); color: #fff;
  font-size: 15px; font-weight: 500; line-height: 1.2; cursor: pointer; text-align: center;
  transition: transform .08s ease, opacity .15s;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn:focus-visible, .icon-btn:focus-visible, a:focus-visible, .chip-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn.full { width: 100%; }
.btn.big { min-height: 56px; font-size: 17px; }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn-outline { background: transparent; color: var(--primary); }
.btn-light { background: #fff; color: var(--primary); border-color: #fff; }
.login-card .btn-light { border-color: var(--hairline); }
.btn-ghost { background: transparent; color: var(--slate); border-color: transparent; margin-top: 4px; }
.btn-ghost-dark { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); padding: 12px 14px; }
.btn-danger { background: transparent; color: var(--error); border-color: #f0c9c9; }
.done-btn { background: var(--pale-green); color: var(--green-ink); border-color: #cdeec5; opacity: 1 !important; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.btn-row .btn { flex: 1 1 auto; }
.band .btn-row .btn-ghost-dark { flex: 0 0 auto; }
.btn-text {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 8px 4px;
  font-size: 14px; color: var(--slate); cursor: pointer; min-height: 40px;
}
.btn-text.active { color: #d24a2c; }
.btn-text.subtle { display: block; margin: 28px auto 0; }

.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; display: inline-block; animation: spin .7s linear infinite; }
.spin.dark { width: 28px; height: 28px; border-color: rgba(0,0,0,.12); border-top-color: var(--primary); }
.btn-outline .spin, .btn-light .spin, .btn-danger .spin, .btn-text .spin { border-color: rgba(0,0,0,.15); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 500;
  background: var(--stone); color: var(--body-muted);
}
.chip.green { background: var(--pale-green); color: var(--green-ink); }
.chip.coral { background: #fff0ec; color: #c43d1f; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  border: 1px solid var(--hairline); background: #fff; border-radius: var(--r-pill);
  padding: 8px 14px; font-size: 14px; cursor: pointer; min-height: 38px;
}
.chip-btn:active { background: var(--stone); }

/* ---- forms ---- */
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--body-muted); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input:not([type]), textarea {
  width: 100%; font: inherit; font-size: 16px; /* 16px stops iPhone zooming in */
  padding: 13px 14px; border: 1px solid var(--hairline); border-radius: 12px; background: #fff; color: var(--ink);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { border-color: #9b60aa; box-shadow: 0 0 0 3px rgba(155,96,170,.15); }
.code-input { font-family: var(--mono); font-size: 26px !important; letter-spacing: .3em; text-transform: uppercase; text-align: center; }

.seg { display: flex; background: var(--stone); border-radius: var(--r-pill); padding: 4px; gap: 4px; }
.seg button {
  flex: 1; border: 0; background: transparent; border-radius: var(--r-pill);
  padding: 10px 12px; font-size: 14px; font-weight: 500; color: var(--slate); cursor: pointer; min-height: 40px;
}
.seg button.on { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg button b { font-weight: inherit; }
.seg.small button { padding: 6px 12px; min-height: 36px; }
.stepper-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--hairline); border-radius: var(--r-pill); background: #fff; }
.stepper button { width: 44px; height: 44px; border: 0; background: none; font-size: 22px; cursor: pointer; border-radius: 50%; }
.stepper output { min-width: 28px; text-align: center; font-family: var(--mono); font-size: 20px; }
.emoji-pick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.emoji-pick button { aspect-ratio: 1; border: 1px solid transparent; background: var(--stone); border-radius: 12px; font-size: 22px; cursor: pointer; }
.emoji-pick button.on { background: #fff; border-color: var(--primary); }
.rules { background: var(--pale-blue); border-radius: 12px; padding: 12px 14px; margin: 0; color: #2b3552; }
.notice { background: var(--pale-green); border-radius: 12px; padding: 10px 14px; margin: 0 0 16px; font-size: 14px; }

/* ---- login ---- */
.login { min-height: 100dvh; display: flex; flex-direction: column; }
.login-hero {
  background: var(--deep-green); color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 40px) 24px 64px;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.how { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: 15px; color: rgba(255,255,255,.88); }
.how span { font-family: var(--mono); font-size: 12px; color: var(--coral-soft); margin-right: 12px; }
.login-card { margin: -36px 16px 32px; padding: 24px; box-shadow: 0 12px 40px rgba(0,0,0,.08); }
.or { display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
@media (min-width: 880px) {
  .login { flex-direction: row; align-items: stretch; }
  .login-hero { flex: 1.2; border-radius: 0; padding: 12vh 6vw; display: flex; flex-direction: column; justify-content: center; }
  .login-card { flex: 0 0 420px; margin: auto 6vw; align-self: center; }
}

/* ---- avatars ---- */
.av {
  position: relative; display: inline-grid; place-items: center; flex: none;
  border-radius: 50%; color: #fff; overflow: hidden; font-weight: 500;
}
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.av-stack { display: flex; align-items: center; margin: 16px 0 4px; }
.av-stack .av { border: 2px solid var(--deep-green); margin-right: -8px; }
.av-stack span:last-child { margin: 0 0 0 18px; }

/* ---- home ---- */
.group-card { padding: 0; }
.group-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; }
.group-head p { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid #f2f2f2; min-height: 64px;
}
.row:active { background: #fafaf8; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.row-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-row { justify-content: space-between; }
.emoji { font-size: 24px; line-height: 1; width: 32px; text-align: center; flex: none; }
.emoji.big { font-size: 30px; width: 40px; }
.emoji.huge { font-size: 44px; width: auto; }
.bar { display: block; height: 6px; background: var(--stone); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--deep-green); border-radius: 6px; transition: width .4s ease; }
.bar.light { background: rgba(255,255,255,.14); margin-top: 14px; }
.bar.light i { background: var(--coral); }

/* ---- group ---- */
.chal-card { padding: 18px 20px; }
.chal-top { display: flex; align-items: center; gap: 14px; }
.chal-top p { margin: 2px 0 0; }
.mini-board { list-style: none; margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid #f2f2f2; display: grid; gap: 10px; }
.mini-board li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.dots { display: inline-flex; align-items: center; gap: 4px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--stone); border: 1px solid var(--hairline); }
.dots i.on { background: var(--deep-green); border-color: var(--deep-green); }
.members summary, details summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details summary::after { content: '+'; font-family: var(--mono); color: var(--slate); font-size: 18px; }
details[open] summary::after { content: '–'; }
details summary::-webkit-details-marker { display: none; }
.list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.list li { display: flex; align-items: center; gap: 12px; }
.link-row { padding: 6px 0; }

/* ---- challenge ---- */
.hero-top { display: flex; gap: 16px; align-items: flex-start; }
.hero-top p { margin: 0; }
.hero-progress { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 24px; }
.hero-progress > div { display: flex; flex-direction: column; }
.hero-progress .right { text-align: right; }
.big-num { font-size: 52px; line-height: 1; letter-spacing: -0.03em; font-weight: 400; }
.big-num small { font-size: 24px; color: rgba(255,255,255,.5); letter-spacing: 0; }
.hero-stat { margin: 20px 0 0; font-size: 22px; display: flex; flex-direction: column; }

.wager-card { border: 1.5px solid var(--coral-soft); }
.wager-card h2 { margin-top: 4px; }

.board { padding: 4px 0; }
.board-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; }
.board-row + .board-row { border-top: 1px solid #f2f2f2; }
.board-row.done { background: linear-gradient(90deg, var(--pale-green), #fff 70%); }
.board-row.faded { opacity: .6; }
.board-row .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-row .micro { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.board-foot { padding: 10px 18px 12px; margin: 0; border-top: 1px solid #f2f2f2; }

.post header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.post header b { display: block; font-weight: 500; line-height: 1.2; }
.post .photo { display: block; width: 100%; padding: 0; border: 0; background: var(--stone); cursor: zoom-in; }
.post .photo img { width: 100%; max-height: 520px; object-fit: cover; }
.post .photo.missing { padding: 60px 0; text-align: center; color: var(--muted); cursor: default; }
.post .note { margin: 12px 16px 0; }
.post footer { display: flex; justify-content: space-between; align-items: center; padding: 4px 10px 6px 16px; }
.post footer .micro { display: inline-flex; align-items: center; gap: 4px; }
.post.removed .photo img { filter: grayscale(1) opacity(.45); }

.hist .result { margin: 2px 0 10px; font-size: 17px; }
.hist .result.good { color: var(--green-ink); }
.hist-people { display: flex; flex-wrap: wrap; gap: 8px; }
.hist-people span { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px;
  padding: 3px 10px 3px 3px; border-radius: var(--r-pill); background: var(--stone); }
.hist-people .ok { background: var(--pale-green); color: var(--green-ink); }
.hist-people .miss { background: #fff0ec; color: #c43d1f; }
.debts { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 0; }
.debts li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid #f2f2f2; }
.debts b { font-weight: 500; }
.debts li.paid .grow { opacity: .55; }

.action-spacer { height: 90px; }
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: linear-gradient(to top, var(--stone) 70%, rgba(238,236,231,0));
}
.action-bar .btn { max-width: 608px; margin: 0 auto; display: flex; box-shadow: 0 8px 24px rgba(23,23,28,.18); }
.end-btn { color: var(--muted); }

/* ---- bottom sheet ---- */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 100; background: rgba(7,24,41,0);
  display: flex; align-items: flex-end; justify-content: center; transition: background .2s;
}
.sheet-wrap.open { background: rgba(7,24,41,.45); }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: #fff; border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 10px 20px calc(24px + var(--safe-b));
  transform: translateY(100%); transition: transform .22s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column; gap: 12px;
}
.sheet-wrap.open .sheet { transform: none; }
.sheet .stack { margin-top: 4px; }
.sheet-grab { width: 40px; height: 4px; border-radius: 4px; background: var(--hairline); margin: 0 auto 8px; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 14px; }
.sheet-head p { margin: 2px 0 0; }
.big-code { font-size: 44px; letter-spacing: .18em; text-align: center; background: var(--stone); border-radius: var(--r-md); padding: 20px 8px 20px 20px; }
.preview { width: 100%; max-height: 50dvh; object-fit: contain; border-radius: var(--r-md); background: var(--stone); }
.full-photo { width: 100%; border-radius: var(--r-md); }
@media (min-width: 640px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: var(--r-lg); padding-bottom: 24px; transform: translateY(24px); opacity: 0; transition: transform .2s, opacity .2s; }
  .sheet-wrap.open .sheet { opacity: 1; }
  .sheet-grab { display: none; }
}

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 20px);
  background: var(--primary); color: #fff; padding: 12px 18px; border-radius: var(--r-pill);
  font-size: 14px; max-width: calc(100% - 32px); width: max-content; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--error); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0s !important; } }
.center-self { align-self: center; }
