/* The Over There App — built for big thumbs and every age. */
[hidden] { display: none !important; }
.app-body { background: var(--cream); font-size: 18px; min-height: 100vh; }
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding: 0 20px calc(110px + env(safe-area-inset-bottom)); }
@media (min-width: 620px) {
  .app { background: #fff; box-shadow: 0 0 0 1px var(--line), var(--shadow-lg); padding-inline: 32px; }
}

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 8px; padding-top: max(18px, env(safe-area-inset-top)); }
.topbar__tag { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--teal); background: var(--mint); padding: 6px 12px; border-radius: 999px; }

.screen { padding-top: 18px; animation: screenIn .35s var(--ease); }
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } }
.screen__title { font-family: var(--serif); font-size: clamp(1.9rem, 7vw, 2.4rem); line-height: 1.1; margin: 4px 0 12px; }
.sub-title { font-family: var(--serif); font-size: 1.45rem; margin: 40px 0 16px; display: flex; align-items: baseline; gap: 10px; }
.big-text { font-size: 1.12rem; line-height: 1.55; }
.small { font-size: .9rem; }
.center { text-align: center; }
.stack { display: grid; gap: 12px; margin-top: 24px; }

/* Buttons — every tap target is at least 56px tall */
.xbtn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 60px; padding: 14px 22px; border-radius: 18px; border: 2px solid transparent;
  font: 600 1.12rem/1.2 var(--sans); cursor: pointer; text-decoration: none; text-align: center;
  transition: transform .15s var(--ease), background .2s, box-shadow .2s;
}
.xbtn:active { transform: scale(.98); }
.xbtn:focus-visible, .mega:focus-visible, .tab:focus-visible, .chips button:focus-visible, .react:focus-visible, .share:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.xbtn--primary { background: var(--teal); color: var(--cream); }
.xbtn--primary:hover { background: var(--teal-2); }
.xbtn--accent { background: var(--coral); color: #fff; margin-top: 20px; }
.xbtn--accent:hover { background: var(--coral-2); }
.xbtn--ghost { background: #fff; border-color: rgba(15,42,42,.18); color: var(--ink); }
.xbtn--ghost:hover { border-color: var(--ink); }
.xbtn--quiet { background: transparent; color: var(--ink-2); font-weight: 500; font-size: 1.02rem; min-height: 56px; }
.xbtn--quiet:hover { background: rgba(15,42,42,.05); }
.xbtn--danger-link { background: transparent; color: #b3261e; font-size: .95rem; font-weight: 500; min-height: 48px; text-decoration: underline; }
.xbtn[disabled] { opacity: .6; pointer-events: none; }
.back { background: none; border: 0; font: 600 1.05rem var(--sans); color: var(--teal); padding: 12px 0; cursor: pointer; min-height: 48px; }

/* Welcome */
.welcome { text-align: center; padding-top: 24px; }
.welcome h1 { font-family: var(--serif); font-size: clamp(2rem, 8vw, 2.7rem); line-height: 1.08; letter-spacing: -.03em; margin: 28px 0 16px; }
.welcome h1 em { color: var(--teal); }
.welcome .big-text { color: var(--ink-2); max-width: 440px; margin: 0 auto; }
.welcome__art { width: 132px; height: 132px; margin: 0 auto; border-radius: 40px; background: var(--mint); display: grid; place-items: center; transform: rotate(-6deg); box-shadow: var(--shadow); }
.welcome__badge { font-size: 4rem; transform: rotate(6deg); }
.community-line { margin-top: 28px; color: var(--muted); font-size: .98rem; }
.community-line strong { color: var(--ink); }

/* Forms */
.form { display: grid; gap: 22px; margin-top: 24px; }
.form--tight { margin-top: 0; gap: 16px; }
.xfield { display: grid; gap: 6px; }
.xfield__label { font-weight: 700; font-size: 1.12rem; }
.xfield__hint { color: var(--muted); font-size: .98rem; line-height: 1.45; }
.xfield input {
  width: 100%; min-height: 62px; padding: 14px 18px; margin-top: 4px; border-radius: 16px;
  border: 2px solid rgba(15,42,42,.2); background: #fff; font: 600 1.25rem var(--sans); color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.xfield input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 5px rgba(13,92,86,.15); }
.xfield input.pin { font-size: 2rem; letter-spacing: .6em; text-align: center; padding-left: calc(18px + .6em); font-variant-numeric: tabular-nums; }
.xcheck { display: flex; align-items: center; gap: 12px; font-size: 1.05rem; cursor: pointer; min-height: 44px; margin-top: -8px; }
.xcheck input { width: 24px; height: 24px; accent-color: var(--teal); }
.form__error { background: #fdecea; color: #8c1d18; border-radius: 14px; padding: 14px 16px; font-weight: 600; }
.money { display: flex; align-items: center; gap: 0; position: relative; }
.money span { position: absolute; left: 18px; top: 50%; transform: translateY(-40%); font-weight: 700; font-size: 1.25rem; color: var(--muted); }
.money input { padding-left: 40px; }

/* Home */
.greeting { color: var(--muted); font-size: 1.05rem; font-weight: 500; }
.mega {
  display: flex; align-items: center; gap: 18px; width: 100%; margin-top: 20px; padding: 26px 24px;
  border: 0; border-radius: 28px; cursor: pointer; text-align: left;
  background: linear-gradient(135deg, var(--teal), #12857b); color: var(--cream);
  box-shadow: 0 18px 40px -16px rgba(13,92,86,.75); transition: transform .15s var(--ease), box-shadow .2s;
  font-family: var(--sans);
}
.mega:hover { transform: translateY(-2px); box-shadow: 0 24px 46px -16px rgba(13,92,86,.8); }
.mega:active { transform: scale(.98); }
.mega__icon { width: 72px; height: 72px; border-radius: 22px; background: rgba(247,243,234,.16); display: grid; place-items: center; font-size: 2.3rem; flex-shrink: 0; }
.mega__text strong { display: block; font-size: 1.45rem; line-height: 1.15; letter-spacing: -.01em; }
.mega__text small { display: block; margin-top: 4px; font-size: 1rem; color: #b9e6d9; }

.card { background: #fff; border-radius: 24px; padding: 22px; margin-top: 20px; box-shadow: 0 1px 0 var(--line), 0 10px 30px -18px rgba(15,42,42,.3); }
.app .card { border: 1px solid var(--line); }
.card__label { font-size: .85rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--teal); margin-bottom: 8px; }
.week__big { font-size: 1.15rem; }
.week__big strong { display: block; font-family: var(--serif); font-size: 2.4rem; line-height: 1.1; letter-spacing: -.02em; }
.week__sub { color: var(--muted); margin-top: 6px; }
.streak { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding: 14px 16px; border-radius: 16px; background: #fff4ec; }
.streak__flame { font-size: 1.8rem; }
.streak strong { display: block; font-size: 1.1rem; }
.streak small { color: var(--muted); font-size: .9rem; }
.streak.is-cold { background: var(--cream); }
.streak.is-cold .streak__flame { filter: grayscale(1); opacity: .5; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
.tile__icon { font-size: 1.5rem; display: block; margin-bottom: 8px; }
.tile strong { display: block; font-family: var(--serif); font-size: 1.8rem; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile small { color: var(--muted); font-size: .92rem; line-height: 1.3; display: block; margin-top: 2px; }

.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge { text-align: center; padding: 16px 8px; border-radius: 18px; background: #fff; border: 1px solid var(--line); }
.badge__icon { font-size: 2rem; display: block; margin-bottom: 6px; }
.badge strong { display: block; font-size: .9rem; line-height: 1.2; }
.badge small { display: block; color: var(--muted); font-size: .76rem; line-height: 1.3; margin-top: 4px; }
.badge.is-locked { background: transparent; border-style: dashed; }
.badge.is-locked .badge__icon { filter: grayscale(1); opacity: .35; }
.badge.is-locked strong { color: var(--muted); }

.history { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.history li { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px 12px 12px 16px; }
.history__icon { font-size: 1.5rem; }
.history__text { flex: 1; min-width: 0; }
.history__text strong { display: block; font-size: 1.02rem; }
.history__text small { color: var(--muted); font-size: .9rem; }
.history__del { border: 0; background: transparent; color: var(--muted); font: 500 .9rem var(--sans); padding: 10px; border-radius: 10px; cursor: pointer; min-height: 44px; }
.history__del:hover { background: #fdecea; color: #8c1d18; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; border: 2px dashed var(--line); border-radius: 20px; list-style: none; }

/* Community */
.leaders { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.leaders li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.leaders li:last-child { border-bottom: 0; }
.leaders .rank { width: 32px; text-align: center; font-weight: 800; color: var(--muted); font-size: 1.05rem; }
.leaders li:nth-child(1) .rank { font-size: 1.4rem; }
.leaders li:nth-child(2) .rank, .leaders li:nth-child(3) .rank { font-size: 1.3rem; }
.leaders .who { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaders .mins { font-family: var(--serif); font-weight: 600; color: var(--teal); white-space: nowrap; }
.leaders .is-me { background: var(--mint-2); border-radius: 12px; }

.feed { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.post-item { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
.post-item__head { display: flex; gap: 12px; align-items: flex-start; }
.post-item__head .avatar { width: 48px; height: 48px; font-size: .85rem; border: 0; }
.post-item__text { flex: 1; min-width: 0; font-size: 1.05rem; line-height: 1.4; }
.post-item__text small { display: block; color: var(--muted); font-size: .88rem; margin-top: 2px; }
.reacts { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.react { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font: 600 .98rem var(--sans); color: var(--ink-2); cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.react:hover { border-color: rgba(15,42,42,.3); }
.react:active { transform: scale(.95); }
.react.is-on { background: var(--mint); border-color: var(--teal); color: var(--teal); }
.react span { font-size: 1.15rem; }

/* Me */
.profile { text-align: center; padding: 12px 0 4px; }
.avatar--xl { width: 96px !important; height: 96px !important; font-size: 1.8rem !important; margin: 0 auto 8px; border: 0 !important; }
.switch { display: flex; align-items: center; gap: 16px; cursor: pointer; }
.switch > span { flex: 1; }
.switch strong { display: block; font-size: 1.08rem; }
.switch small { display: block; color: var(--muted); font-size: .95rem; line-height: 1.4; margin-top: 4px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { width: 64px; height: 38px; border-radius: 999px; background: #cfd8d7; position: relative; flex-shrink: 0; transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 4px; left: 4px; width: 30px; height: 30px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .25s var(--ease); }
.switch input:checked + i { background: var(--teal); }
.switch input:checked + i::after { transform: translateX(26px); }
.switch input:focus-visible + i { outline: 3px solid var(--coral); outline-offset: 3px; }

/* Bottom tabs */
.tabs {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 40;
  width: min(560px, 100%); display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(255,255,255,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
}
.tab { display: grid; justify-items: center; gap: 2px; min-height: 64px; padding: 8px 4px; border: 0; background: transparent; border-radius: 16px; font: 600 .95rem var(--sans); color: var(--muted); cursor: pointer; }
.tab span { font-size: 1.5rem; line-height: 1; filter: grayscale(1); opacity: .6; transition: filter .2s, opacity .2s, transform .2s; }
.tab.is-active { color: var(--teal); background: var(--mint-2); }
.tab.is-active span { filter: none; opacity: 1; transform: translateY(-1px); }

/* Sheets */
.sheet { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(15,42,42,.45); animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.sheet__panel {
  position: relative; width: min(560px, 100%); max-height: 92vh; overflow-y: auto;
  background: #fff; border-radius: 28px 28px 0 0; padding: 14px 22px calc(24px + env(safe-area-inset-bottom));
  animation: up .35s var(--ease);
}
@keyframes up { from { transform: translateY(100%); } }
.sheet__panel h2 { font-family: var(--serif); font-size: 1.7rem; margin: 10px 0 6px; line-height: 1.15; }
.sheet__panel--center { text-align: center; padding-top: 30px; }
.sheet__grip { width: 48px; height: 5px; border-radius: 99px; background: rgba(15,42,42,.15); margin: 0 auto 10px; }
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0 14px; }
.chips button { min-height: 72px; border-radius: 18px; border: 2px solid var(--line); background: var(--cream); font: 700 1.2rem var(--sans); color: var(--ink); cursor: pointer; transition: background .15s, border-color .15s, transform .1s; }
.chips button:hover { border-color: var(--teal); background: var(--mint-2); }
.chips button:active { transform: scale(.96); }
.done__burst { font-size: 4rem; animation: pop .5s var(--ease); }
.new-badge { margin-top: 18px; padding: 16px; border-radius: 18px; background: #fff4ec; border: 2px solid #ffd3bd; font-weight: 600; display: flex; align-items: center; gap: 14px; text-align: left; }
.new-badge span { font-size: 2.2rem; }
.new-badge small { display: block; color: var(--muted); font-weight: 500; }

.share-preview { background: var(--cream); border-radius: 16px; padding: 16px; margin: 14px 0 18px; font-size: 1.02rem; line-height: 1.5; color: var(--ink-2); }
.share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.share { display: grid; justify-items: center; gap: 6px; padding: 14px 6px; border-radius: 16px; border: 1px solid var(--line); text-decoration: none; font-weight: 600; font-size: .92rem; color: var(--ink); background: #fff; min-height: 84px; align-content: center; }
.share span { font-size: 1.6rem; line-height: 1; }
.share:hover { background: var(--mint-2); }
#shareSheet .xbtn + .xbtn { margin-top: 10px; }

.app-body .toast { bottom: calc(100px + env(safe-area-inset-bottom)); }

@media (max-width: 380px) {
  .app { padding-inline: 14px; }
  .badges { grid-template-columns: repeat(2, 1fr); }
  .mega { padding: 20px 18px; gap: 14px; }
  .mega__icon { width: 60px; height: 60px; font-size: 2rem; }
  .mega__text strong { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .screen, .sheet__panel, .sheet__backdrop, .done__burst { animation: none; }
}

.optin { border: 2px solid var(--mint) !important; background: var(--mint-2); }
.optin__title { font-weight: 700; font-size: 1.12rem; margin-bottom: 6px; }
.optin .xbtn { margin-top: 16px; }

/* Share sheet: link is created on open */
.share-preview p + p { margin-top: 10px; }
.share-link { display: flex; gap: 8px; align-items: center; font-weight: 600; color: var(--teal); word-break: break-all; }
.share-exp { font-size: .9rem; color: var(--muted); }
.share-grid.is-loading .share, #copyBtn[disabled], #shNative[disabled] { opacity: .45; pointer-events: none; }
.share-native { margin: 0 0 14px; }
