/* TRYSA Share — app styles. Visual language: soft neutral surfaces, big rounded
   cards, black pill actions, system-style alerts (light + dark). */
:root {
  --bg: #f5f5f7; --surface: #ffffff; --surface-2: #efeff4; --ink: #111114; --ink-2: #3c3c43;
  --muted: #8a8a92; --line: rgba(60, 60, 67, .14); --accent: #0a6cff; --accent-ink: #fff;
  --pill: #1c1c1e; --pill-ink: #fff; --ok: #30c85e; --warn: #ff9f0a; --danger: #ff3b30;
  --alert-bg: rgba(242, 242, 247, .86); --alert-line: rgba(60, 60, 67, .22);
  --shadow: 0 30px 70px rgba(15, 15, 30, .14), 0 6px 18px rgba(15, 15, 30, .06);
  --radius: 34px; --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000; --surface: #1c1c1e; --surface-2: #2c2c2e; --ink: #f5f5f7; --ink-2: #d1d1d6; --muted: #8e8e93;
    --line: rgba(255, 255, 255, .12); --accent: #3b8cff; --pill: #f5f5f7; --pill-ink: #111;
    --alert-bg: rgba(44, 44, 46, .86); --alert-line: rgba(255, 255, 255, .14);
    --shadow: 0 30px 70px rgba(0, 0, 0, .6), 0 6px 18px rgba(0, 0, 0, .4);
  }
}
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.35 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input, select { font: inherit; color: inherit; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; margin: 12px 4px 0; line-height: 1.45; }

/* ---------------------------------------------------------------- screens */
.screen { max-width: 520px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 16px calc(30px + env(safe-area-inset-bottom)); }
.center { min-height: 100vh; display: grid; place-items: center; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.signin-card { width: 100%; text-align: center; }
.signin-card h1 { margin: 14px 0 6px; font-size: 28px; letter-spacing: -.02em; }
.logo { width: 64px; height: 64px; margin: 0 auto; border-radius: 18px; background: url(/share/icon.svg) center/cover; }
.field { display: block; text-align: left; margin: 22px 0 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px 4px; }
.field input { width: 100%; padding: 15px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); outline: none; }
.field input:focus { border-color: var(--accent); }
.field + .field { margin-top: 0; }
.oauth-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 12px; padding: 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 16px; }
.oauth-btn .brand { width: 20px; height: 20px; stroke: none; } .oauth-btn .apple { fill: currentColor; }
.signin-card .logo + h1 + p + .oauth-btn { margin-top: 22px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.signin-card .field { margin: 14px 0 12px; }
.pw { margin-top: 14px; text-align: left; } .pw summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 15px; text-align: center; list-style: none; }
.pw summary::-webkit-details-marker { display: none; }

.topbar { display: flex; justify-content: space-between; align-items: flex-end; margin: 6px 4px 16px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--muted); }
.title { margin: 0; font-size: 34px; letter-spacing: -.025em; }
.avatar-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2) center/cover; font-weight: 700; color: var(--muted); }

.receiving { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; background: var(--surface); padding: 14px 16px; border-radius: 20px; }
.receiving b { display: block; font-size: 15px; } .receiving small { color: var(--muted); font-size: 13px; }
.receiving span:nth-child(2) { flex: 1; }
.receiving .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px color-mix(in srgb, var(--muted) 18%, transparent); }
.receiving .dot.on { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); }
.chev { color: var(--muted); font-size: 18px; }

.pick { position: relative; display: grid; justify-items: center; gap: 4px; margin: 14px 0 26px; padding: 34px 20px; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; text-align: center; }
.pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pick b { font-size: 19px; letter-spacing: -.01em; } .pick small { color: var(--muted); }
.pick-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--pill); color: var(--pill-ink); font-size: 26px; margin-bottom: 8px; }

.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 4px 10px; }
.section-head h2 { margin: 0; font-size: 20px; letter-spacing: -.015em; }

/* nearby people: mini person cards */
.people-row { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 18px; margin: 0 -2px 8px; scrollbar-width: none; }
.people-row:empty::after { content: "Ask your friend to open TRYSA Share and turn Receiving on."; color: var(--muted); font-size: 14px; padding: 8px 4px; }
.mini-card { flex: none; width: 132px; height: 170px; border-radius: 26px; position: relative; overflow: hidden; scroll-snap-align: start; box-shadow: var(--shadow);
  background: var(--surface-2) center/cover; color: #fff; text-align: left; }
.mini-card::after { content: ""; position: absolute; inset: 40% 0 0; background: linear-gradient(transparent, var(--fade, rgba(0,0,0,.55))); }
.mini-card b, .mini-card small { position: absolute; left: 12px; right: 12px; z-index: 1; text-shadow: 0 1px 8px rgba(0,0,0,.35); }
.mini-card b { bottom: 26px; font-size: 15px; } .mini-card small { bottom: 10px; font-size: 12px; opacity: .9; }
.initials { display: grid; place-items: center; font-weight: 700; color: #fff; letter-spacing: -.02em; }

.segment { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 14px; margin: 6px 0 12px; }
.segment button { flex: 1; padding: 9px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); }
.segment button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; }

.list { display: grid; gap: 2px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; background: var(--surface); text-align: left; width: 100%; }
.row + .row { margin-top: 6px; }
.row .av { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--surface-2) center/cover; }
.row .txt { flex: 1; min-width: 0; } .row .txt b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .txt small { color: var(--muted); font-size: 13px; }
.row .tag { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 20px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.row .tag.go { background: var(--pill); color: var(--pill-ink); }
.empty { color: var(--muted); text-align: center; padding: 26px 10px; font-size: 14px; }

.pill-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--pill); color: var(--pill-ink); font-weight: 600;
  padding: 14px 20px; border-radius: 16px; font-size: 16px; letter-spacing: -.01em; }
.pill-btn.wide { width: 100%; } .pill-btn.ghost { background: var(--surface-2); color: var(--ink); }
.pill-btn:disabled { opacity: .5; }
.text-btn { color: var(--accent); font-weight: 600; font-size: 16px; }
.link-btn { color: #fff; font-weight: 600; opacity: .9; }

/* ---------------------------------------------------------------- sheets */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.28); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease; }
.sheet { width: 100%; max-width: 560px; max-height: 94vh; overflow: auto; background: var(--bg); border-radius: 30px 30px 0 0;
  padding: 18px 0 calc(22px + env(safe-area-inset-bottom)); animation: up .32s cubic-bezier(.2,.9,.25,1); }
.small-sheet, .tall-sheet { padding: 14px 16px calc(22px + env(safe-area-inset-bottom)); }
.tall-sheet { min-height: 70vh; }
.sheet-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 14px; }
.sheet-bar h2 { margin: 0; font-size: 17px; text-align: center; } .sheet-bar > :last-child { justify-self: end; } .sheet-bar > :first-child { justify-self: start; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }

.sheet-head { display: flex; align-items: center; gap: 14px; padding: 0 18px 16px; }
.sheet-thumb { width: 62px; height: 62px; border-radius: 14px; object-fit: cover; background: var(--surface-2); }
.sheet-titles { flex: 1; } .sheet-titles h2 { margin: 0 0 6px; font-size: 19px; letter-spacing: -.01em; }
.options-pill { display: inline-flex; align-items: center; gap: 4px; padding: 7px 14px; border-radius: 20px; background: var(--surface); font-size: 15px; font-weight: 500; }
.options-pill svg { color: var(--muted); }
.round-close { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 20px; }

.carousel { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 18% 18px; scrollbar-width: none; }
.carousel::-webkit-scrollbar, .people-row::-webkit-scrollbar { display: none; }
.slide { flex: none; width: 64%; max-width: 330px; aspect-ratio: 3 / 4; border-radius: 26px; overflow: hidden; scroll-snap-align: center; background: var(--surface-2); position: relative; }
.slide img, .slide video { width: 100%; height: 100%; object-fit: cover; display: block; }
.slide.doc { display: grid; place-items: center; align-content: center; gap: 8px; background: var(--surface); text-align: center; padding: 18px; }
.slide.doc b { font-size: 30px; letter-spacing: .02em; color: var(--accent); } .slide.doc span { font-size: 14px; color: var(--ink-2); word-break: break-word; }
.slide .size { position: absolute; left: 10px; bottom: 10px; font-size: 12px; font-weight: 600; color: #fff; background: rgba(0,0,0,.4); padding: 3px 8px; border-radius: 10px; backdrop-filter: blur(8px); }

.dest-people { display: flex; gap: 18px; overflow-x: auto; padding: 4px 18px 14px; scrollbar-width: none; }
.dest-people:empty { display: none; }
.dest-person { flex: none; width: 70px; display: grid; justify-items: center; gap: 6px; font-size: 12px; text-align: center; }
.dest-person .av { width: 64px; height: 64px; border-radius: 50%; background: var(--surface-2) center/cover; position: relative; }
.dest-person .av::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='1.6' fill='white'/%3E%3Cpath d='M8.5 15.5a5 5 0 0 1 0-7M15.5 8.5a5 5 0 0 1 0 7'/%3E%3C/svg%3E") center/16px no-repeat; border: 2px solid var(--bg); }
.dest-person span { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dest-row { display: flex; gap: 8px; justify-content: space-between; padding: 14px 18px 4px; border-top: 1px solid var(--line); margin: 0 0; }
.dest { flex: 1; display: grid; justify-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.dest-icon { width: 66px; height: 66px; border-radius: 18px; display: grid; place-items: center; font-size: 36px; color: #fff; box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.dest-icon svg { stroke-width: 2.6; }
.i-nearby { background: linear-gradient(160deg, #4b9bff, #0a5cff); }
.i-nearby svg circle { fill: #fff; stroke: none; }
.i-qr { background: linear-gradient(160deg, #2c2c2e, #000); } .i-qr svg { fill: #fff; stroke: none; }
.i-contacts { background: linear-gradient(160deg, #3fdc6d, #12a83b); }
.i-link { background: linear-gradient(160deg, #a7a7ae, #6d6d75); }

.opt-group { background: var(--surface); border-radius: 18px; overflow: hidden; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; min-height: 52px; }
.opt-row + .opt-row { border-top: 1px solid var(--line); }
.opt-row select, .opt-row input:not([type=checkbox]) { border: 0; background: transparent; color: var(--muted); text-align: right; max-width: 55%; outline: none; }
.card-row { background: var(--surface); border-radius: 18px; margin-top: 14px; }
.radio button { display: block; width: 100%; text-align: left; padding: 14px 16px 14px 48px; position: relative; }
.radio button + button { border-top: 1px solid var(--line); }
.radio button small { display: block; color: var(--muted); font-size: 13px; }
.radio button::before { content: ""; position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%; border: 2px solid var(--line); }
.radio button.on::before { border: 6px solid var(--accent); }
.switch { appearance: none; width: 51px; height: 31px; border-radius: 16px; background: var(--surface-2); position: relative; transition: background .2s; flex: none; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.2); transition: transform .2s; }
.switch:checked { background: var(--ok); } .switch:checked::after { transform: translateX(20px); }

.search { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; color: var(--muted); }
.search input { flex: 1; border: 0; background: transparent; outline: none; color: var(--ink); }

/* ---------------------------------------------------------------- person card */
.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; align-content: center; gap: 18px; padding: 20px;
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); animation: fade .2s ease; }
.person-card { width: min(380px, 92vw); aspect-ratio: 360 / 480; border-radius: 40px; overflow: hidden; position: relative; box-shadow: var(--shadow);
  background: var(--card-bg, #cfd8e3); color: #fff; animation: pop .35s cubic-bezier(.2,.9,.25,1.15); }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.pc-media { position: absolute; inset: 0; background: center 30%/cover no-repeat; }
.pc-media.initials { font-size: 120px; background: linear-gradient(160deg, var(--g1, #8fb3ff), var(--g2, #3a5bd9)); }
.pc-media::after { content: ""; position: absolute; inset: 52% 0 0; background: linear-gradient(to bottom, transparent, var(--fade, rgba(40,48,30,.92)) 78%);
  backdrop-filter: blur(0); -webkit-mask: linear-gradient(transparent, #000 45%); }
.pc-media::before { content: ""; position: absolute; inset: 0 0 62%; background: linear-gradient(var(--fade-top, rgba(0,0,0,.18)), transparent); z-index: 1; }
.pc-top { position: absolute; top: 34px; left: 0; right: 0; text-align: center; z-index: 2; }
.pc-name { margin: 0; font-size: 34px; font-weight: 600; letter-spacing: -.03em; text-shadow: 0 2px 18px rgba(0,0,0,.25); }
.pc-status { margin-top: 8px; display: inline-flex; align-items: center; gap: 8px; font-size: 17px; opacity: .92; text-shadow: 0 1px 10px rgba(0,0,0,.3); }
.pc-progress { position: absolute; left: 24px; right: 24px; bottom: 96px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.3); z-index: 2; overflow: hidden; }
.pc-progress i { display: block; height: 100%; width: 0; background: #fff; border-radius: 3px; transition: width .25s ease; }
.pc-foot { position: absolute; left: 18px; right: 18px; bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; z-index: 2; }
.pc-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pc-who b { display: block; font-size: 17px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-who small { display: block; color: rgba(255,255,255,.72); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-who > span:last-child { min-width: 0; }
.pc-status .check { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 13px; text-shadow: none; }
.mini-avatar { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.3) center/cover; border: 2px solid rgba(255,255,255,.8); }
.online { position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ok); border: 3px solid #fff; }
.person-card .pill-btn { background: #fff; color: #111; box-shadow: 0 8px 20px rgba(0,0,0,.18); padding: 14px 18px; white-space: nowrap; }
.person-card.light { color: #111; }
.person-card.light .pc-who small { color: rgba(0,0,0,.55); }
.person-card.light .pc-name, .person-card.light .pc-status { text-shadow: none; }
.person-card.light .person-card .pill-btn, .person-card.light .pill-btn { background: #1c1c1e; color: #fff; }
.person-card.framed { background: var(--surface); padding: 22px 22px 0; color: var(--ink); }
.person-card.framed .pc-media { inset: 22px 22px 108px; border-radius: 28px; background-color: #ececef; }
.person-card.framed .pc-media::after, .person-card.framed .pc-media::before { display: none; }
.person-card.framed .pc-name, .person-card.framed .pc-status { text-shadow: none; color: #111; }
.person-card.framed .pc-top { top: 52px; }
.person-card.framed .pc-who small { color: var(--muted); } .person-card.framed .pc-who b { color: var(--ink); }
.person-card.framed .pill-btn { background: var(--pill); color: var(--pill-ink); box-shadow: none; }
.person-card.framed .mini-avatar { border-color: var(--surface); }
.person-card.framed .pc-progress { bottom: 124px; background: rgba(0,0,0,.12); } .person-card.framed .pc-progress i { background: #111; }
.qr-box { position: absolute; inset: 0; display: grid; place-items: center; padding-top: 96px; }
.qr-box svg { width: 54%; height: auto; background: #fff; padding: 12px; border-radius: 20px; stroke: none; }
.under-card { font-size: 15px; color: var(--ink-2); }

/* iOS-style activity indicator */
.spinner { position: relative; width: 18px; height: 18px; display: inline-block; }
.spinner i { position: absolute; left: 8px; top: 1px; width: 2px; height: 5px; border-radius: 1px; background: currentColor; transform-origin: 1px 8px; animation: spin 0.8s linear infinite; opacity: .2; }
.spinner i:nth-child(1) { transform: rotate(0deg); animation-delay: -.7s; } .spinner i:nth-child(2) { transform: rotate(45deg); animation-delay: -.6s; }
.spinner i:nth-child(3) { transform: rotate(90deg); animation-delay: -.5s; } .spinner i:nth-child(4) { transform: rotate(135deg); animation-delay: -.4s; }
.spinner i:nth-child(5) { transform: rotate(180deg); animation-delay: -.3s; } .spinner i:nth-child(6) { transform: rotate(225deg); animation-delay: -.2s; }
.spinner i:nth-child(7) { transform: rotate(270deg); animation-delay: -.1s; } .spinner i:nth-child(8) { transform: rotate(315deg); animation-delay: 0s; }
@keyframes spin { 0% { opacity: 1; } 100% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .spinner i { animation: none; opacity: .6; } .sheet, .person-card, .alert { animation: none; } }

/* ---------------------------------------------------------------- incoming alert */
.alert-overlay { background: rgba(0,0,0,.25); }
.alert { width: min(300px, 86vw); border-radius: 16px; overflow: hidden; background: var(--alert-bg); backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%); text-align: center; animation: pop .25s ease; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.alert-text { padding: 19px 16px 16px; } .alert h2 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.alert p { margin: 0; font-size: 14px; line-height: 1.35; color: var(--ink); }
.alert-preview img { display: block; width: 100%; max-height: 52vh; object-fit: cover; }
.alert-progress { padding: 12px 16px 14px; } .alert-progress .bar { height: 4px; border-radius: 2px; background: var(--alert-line); overflow: hidden; }
.alert-progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.alert-progress small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.alert-actions { display: grid; grid-template-columns: 1fr 1fr; border-top: .5px solid var(--alert-line); }
.alert-actions.single { grid-template-columns: 1fr; }
.alert-actions button { padding: 13px 8px; font-size: 17px; color: var(--accent); }
.alert-actions button + button { border-left: .5px solid var(--alert-line); }
.alert-actions .strong { font-weight: 600; }
.alert-actions button:active { background: var(--alert-line); }

.received-actions { display: grid; gap: 10px; padding: 0 4px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; background: var(--pill); color: var(--pill-ink);
  padding: 12px 18px; border-radius: 16px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow); max-width: 90vw; animation: up .25s ease; }
