/*
 * TEVRA landing page.
 * Tokens mirror core/designsystem (TevraColors, TevraTypography, TevraDimens).
 * Component sizes are taken from the Figma exports in docs/design/new exports (402pt frames, 1 CSS px = 1 pt).
 */

@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url("assets/fonts/poppins_medium.woff") format("woff"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url("assets/fonts/poppins_semibold.woff") format("woff"); }
/* Plus Jakarta Sans ships as one variable font (wght 200–800). */
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 200 800; font-display: swap; src: url("assets/fonts/plusjakartasans_variable.woff") format("woff"); }

:root {
    --primary: #FF5A3C;
    --primary-600: #FF7658;
    --primary-700: #FF9075;
    --primary-100: #5C150A;
    --primary-300: #A82D16;
    --primary-900: #FFD8CC;
    --secondary: #2DD4BF;
    --secondary-100: #08403A;
    --secondary-400: #17A692;
    --accent-400: #BC9AFA;
    --accent-500: #8B5CF6;
    --milestone: #B794F6;
    --success: #22C55E;

    --on-primary: #161A21;

    --text-primary: #F4F6F8;
    --text-secondary: #AEB6C2;
    --text-muted: #6B7484;
    --text-success: #72DE95;
    --text-secondary-accent: #7DE8D8;
    --neutral-500: #8A93A2;
    --neutral-700: #C7CDD8;
    --neutral-800: #E4E7EC;

    --border: #2A303B;
    --border-strong: #3A414F;

    --bg-page: #0E1116;
    --bg-surface: #161A21;
    --bg-raised: #1E232C;
    --bg-subtle: #12151B;
    --bg-primary-subtle: #2A1710;
    --bg-secondary-subtle: #0A2622;
    --bg-success-subtle: #0C2417;
    --bg-error-subtle: #2A1214;
    --bg-level-subtle: #231A35;

    --font-display: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --pill: 999px;
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
    --gutter: clamp(16px, 5vw, 64px);
    --max: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
body {
    margin: 0;
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
p, h1, h2, h3, ol, ul { margin: 0; }
hr { margin: 0; border: 0; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--primary); color: var(--on-primary); }
:focus-visible { outline: 2px solid var(--primary-600); outline-offset: 3px; border-radius: 8px; }

.skip-link { position: fixed; z-index: 100; top: 12px; left: 12px; padding: 10px 16px; border-radius: var(--r-md); background: var(--primary); color: var(--on-primary); font-weight: 600; transform: translateY(-200%); transition: transform .2s; }
.skip-link:focus { transform: none; }

.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.emoji { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; line-height: 1; }

/* ---------- Type (TevraTypography scaled up for marketing headings) ---------- */
.display { font-family: var(--font-display); font-weight: 600; font-size: clamp(40px, 6.2vw, 80px); line-height: 1.06; letter-spacing: -0.03em; }
.h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(30px, 4vw, 48px); line-height: 1.15; letter-spacing: -0.02em; }
.h3 { font-family: var(--font-display); font-weight: 500; font-size: 20px; line-height: 28px; }
.display, .h1 { text-wrap: balance; }
.lead { text-wrap: pretty; font-size: clamp(16px, 1.35vw, 18px); line-height: 1.6; color: var(--text-secondary); max-width: 34em; }
.overtitle { font-weight: 600; font-size: 12px; line-height: 16px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 16px; }
.center { text-align: center; margin-left: auto; margin-right: auto; }
.coral { color: var(--primary-600); }
.teal { color: var(--secondary); }
.violet { color: var(--accent-400); }
.accent {
    background: linear-gradient(100deg, var(--primary) 0%, var(--primary-700) 45%, var(--milestone) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: sheen 6s ease-in-out infinite alternate;
}
@keyframes sheen { to { background-position: 100% 0; } }

/* ---------- Buttons (TevraButton: 56 / 40 tall, Poppins) ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border-radius: var(--pill); border: 1px solid transparent;
    font-family: var(--font-display); letter-spacing: .2px;
    transition: background-color .2s, border-color .2s, color .2s, transform .25s var(--ease-spring), box-shadow .3s;
    white-space: nowrap; user-select: none;
}
.btn-lg { height: 56px; padding: 0 28px; font-size: 16px; line-height: 24px; font-weight: 500; }
.btn-sm { height: 40px; padding: 0 20px; font-size: 14px; line-height: 20px; font-weight: 600; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-600); box-shadow: 0 12px 32px -10px rgba(255, 90, 60, .7); }
.btn-primary:active { background: var(--primary-700); transform: scale(.97); }
.btn-ghost { border-color: var(--border-strong); color: var(--text-primary); }
.btn-ghost:hover { border-color: var(--neutral-500); background: rgba(255, 255, 255, .03); }
.btn-ghost:active { transform: scale(.97); }
.btn .ic { width: 20px; height: 20px; stroke-width: 2; transition: transform .3s var(--ease-out); }
.btn:hover .ic { transform: translateX(4px); }

/* ---------- Nav ---------- */
.nav {
    position: fixed; z-index: 50; top: 16px; left: var(--gutter); right: var(--gutter);
    max-width: var(--max); margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    height: 60px; padding: 0 10px 0 24px;
    border-radius: var(--pill); border: 1px solid transparent;
    transition: background-color .35s, border-color .35s, transform .45s var(--ease-out);
}
.nav.scrolled { background: rgba(22, 26, 33, .78); border-color: var(--border); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); }
.nav.hidden { transform: translateY(-140%); }
.wordmark { font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 1; letter-spacing: .02em; }
.nav-links { display: flex; gap: 32px; font-size: 15px; color: var(--text-secondary); }
.nav-links a { position: relative; padding: 8px 0; transition: color .2s; }
.nav-links a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px; background: var(--primary); transform: scaleX(0); transition: transform .3s var(--ease-out); }
.nav-links a:hover, .nav-links a.active { color: var(--text-primary); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }

.cursor-glow {
    position: fixed; z-index: 0; pointer-events: none; top: 0; left: 0;
    width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 90, 60, .09), transparent 65%);
    transform: translate3d(var(--x, -999px), var(--y, -999px), 0);
    opacity: 0; transition: opacity .4s;
}
.has-pointer .cursor-glow { opacity: 1; }

/* ---------- Hero ---------- */
.hero {
    position: relative; isolation: isolate;
    min-height: 100vh; min-height: 100svh;
    display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: 48px;
    max-width: var(--max); margin: 0 auto; padding: 128px var(--gutter) 88px;
}
.hero-bg { position: absolute; inset: 0 calc(50% - 50vw); z-index: -1; overflow: hidden; pointer-events: none; background-color: var(--bg-page); }
.pattern {
    position: absolute; inset: 0;
    background: url("assets/brand_pattern.jpg") center / cover no-repeat;
    mix-blend-mode: multiply; opacity: .9;
    animation: drift 40s ease-in-out infinite alternate;
}
/* The pattern is a crop, not a tile: zoom and pan it instead of scrolling. */
@keyframes drift { from { transform: scale(1.05); } to { transform: scale(1.25) translate3d(-3%, -2%, 0); } }
.hero-bg::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(to bottom, transparent 60%, var(--bg-page)), linear-gradient(135deg, rgba(105, 33, 15, .08), rgba(150, 75, 255, .08));
}
.blob { position: absolute; border-radius: 50%; filter: blur(80px); animation: float-blob 18s ease-in-out infinite alternate; }
.blob-warm { width: 520px; height: 520px; background: #FF5A3C; right: 4%; top: 10%; opacity: .22; }
.blob-violet { width: 460px; height: 460px; background: #8B5CF6; left: -6%; bottom: 0; opacity: .2; animation-delay: -6s; }
.blob-teal { width: 320px; height: 320px; background: #2DD4BF; right: 30%; bottom: 8%; opacity: .12; animation-delay: -11s; }
@keyframes float-blob { 50% { transform: translate(60px, -40px) scale(1.1); } 100% { transform: translate(-40px, 30px) scale(.95); } }

.hero-copy .display { margin-bottom: 24px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.hero-proof { list-style: none; padding: 0; margin-top: 36px; display: flex; flex-wrap: wrap; gap: 12px 28px; font-size: 14px; line-height: 20px; color: var(--text-secondary); }
.hero-proof li { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-teal { background: var(--secondary); box-shadow: 0 0 12px var(--secondary); }
.dot-coral { background: var(--primary); box-shadow: 0 0 12px var(--primary); }
.dot-violet { background: var(--milestone); box-shadow: 0 0 12px var(--milestone); }

/* Split-word headline reveal */
.word { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .1em; margin-bottom: -.1em; }
.word > span { display: inline-block; transform: translateY(110%); transition: transform 1s var(--ease-out); transition-delay: calc(var(--i) * 70ms + 150ms); }
.in .word > span { transform: none; }

/* ---------- Phone with real app screens ---------- */
.hero-visual { position: relative; display: flex; flex-direction: column; align-items: center; gap: 24px; perspective: 1400px; text-align: left; }
.phone {
    /* Screen keeps the 402×874 Figma frame ratio. */
    --screen-w: clamp(250px, calc((100vh - 300px) * 402 / 874), 316px);
    position: relative; padding: 12px; border-radius: 54px;
    background: linear-gradient(150deg, #2B313C, #12151B 40%, #1E232C);
    box-shadow: inset 0 0 0 1px var(--border-strong), 0 60px 120px -30px rgba(0, 0, 0, .8), 0 0 120px -20px rgba(255, 90, 60, .25);
    transform: rotateY(var(--ry, -8deg)) rotateX(var(--rx, 4deg));
    transition: transform .6s var(--ease-out);
    animation: phone-in 1.4s var(--ease-out) .2s both;
}
@keyframes phone-in { from { opacity: 0; transform: translateY(80px) rotateY(-24deg) rotateX(16deg); } }
.phone-island {
    position: absolute; z-index: 2; left: 50%; top: calc(12px + var(--screen-w) * 11 / 402);
    width: calc(var(--screen-w) * 124 / 402); height: calc(var(--screen-w) * 36 / 402);
    transform: translateX(-50%); border-radius: var(--pill); background: #000;
}
.screen { position: relative; width: var(--screen-w); aspect-ratio: 402 / 874; border-radius: 42px; overflow: hidden; clip-path: inset(0 round 42px); background: var(--bg-page); }
.shot { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transform: scale(1.04); transition: opacity .7s var(--ease-out), transform 1.2s var(--ease-out); }
.shot.is-active { opacity: 1; transform: none; }
.shot-tabs { display: flex; gap: 8px; }
.shot-tabs button {
    display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 84px; padding: 4px 6px;
    font-size: 13px; line-height: 16px; color: var(--text-muted); transition: color .2s;
}
.shot-tabs button[aria-selected="true"] { color: var(--text-primary); }
.shot-tabs .bar { position: relative; display: block; width: 100%; height: 3px; border-radius: var(--pill); background: var(--bg-raised); overflow: hidden; }
.shot-tabs .bar i { position: absolute; inset: 0; background: var(--primary); transform: scaleX(0); transform-origin: left; }
.shot-tabs button[aria-selected="true"] .bar i { animation: shot-progress var(--shot-ms, 4500ms) linear forwards; }
.shot-tabs.paused button[aria-selected="true"] .bar i { animation-play-state: paused; }
@keyframes shot-progress { to { transform: scaleX(1); } }

/* ---------- Floating widgets ---------- */
.float { position: absolute; z-index: 3; transform: translate3d(var(--fx, 0), var(--fy, 0), 0); transition: transform .5s var(--ease-out); pointer-events: none; }
.float > * { animation: bob 6s ease-in-out infinite, float-in 1s var(--ease-spring) both; box-shadow: 0 20px 50px -12px rgba(0, 0, 0, .7); }
.float-1 { top: 14%; left: -4%; }
.float-1 > * { animation-delay: 0s, 1.5s; }
.float-2 { top: 3%; right: 6%; }
.float-2 > * { animation-delay: -2s, 1.8s; }
.float-3 { bottom: 22%; right: -6%; }
.float-3 > * { animation-delay: -4s, 2.1s; }
.float-4 { bottom: 36%; left: 0; }
.float-4 > * { animation-delay: -1s, 2.3s; }
.float-5 { top: 40%; right: -2%; }
.float-5 > * { animation-delay: -3s, 2.5s; }
@keyframes bob { 50% { transform: translateY(-12px); } }
@keyframes float-in { from { opacity: 0; scale: .6; } }

/* TevraToast (success): 1px tinted border, surface fill, 24 icon. */
.toast { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; border-radius: var(--r-lg); border: 1px solid var(--success); background: var(--bg-surface); }
.toast .ic { color: var(--success); }
.toast b { display: block; font-weight: 600; font-size: 14px; line-height: 20px; }
.toast span { display: block; font-size: 12px; line-height: 16px; color: var(--text-secondary); }

.hex-chip { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r-md); background: var(--bg-surface); }

/* ---------- Level hex (HexLevelBadge.kt, drawn as SVG by main.js) ---------- */
.hex { position: relative; display: inline-grid; place-items: center; flex: none; }
.hex svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hex b { position: relative; font-family: var(--font-display); font-weight: 500; font-size: 20px; line-height: 28px; }
.hex[data-hex-size="36"] b { font-weight: 600; font-size: 16px; line-height: 24px; }

/* Sport chip (Figma chip: 32 tall, 1px border, 16/24 label). */
.sport-chip {
    display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 16px;
    border-radius: var(--pill); border: 1px solid var(--border-strong); background: var(--bg-page);
    font-size: 16px; line-height: 24px; color: var(--text-primary); white-space: nowrap;
}
.sport-chip .emoji { font-size: 16px; }
.sport-chip.is-selected { background: var(--bg-primary-subtle); border-color: var(--primary); color: var(--primary-600); }

/* ---------- Marquee ---------- */
.marquee { position: relative; padding: 28px 0; overflow: hidden; border-block: 1px solid var(--border); background: var(--bg-subtle); -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee-track { display: flex; gap: 12px; width: max-content; animation: marquee 40s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(calc(-50% - 6px)); } }

/* ---------- Features ---------- */
.feature {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: clamp(40px, 6vw, 96px);
    max-width: var(--max); margin: 0 auto; padding: clamp(88px, 12vw, 160px) var(--gutter);
}
.feature-flip .feature-copy { order: 2; }
.feature-copy .h1 { margin-bottom: 20px; }
.ticks { list-style: none; padding: 0; margin-top: 28px; display: grid; gap: 14px; }
.ticks li { position: relative; padding-left: 34px; color: var(--neutral-700); line-height: 24px; }
.ticks li::before {
    content: ""; position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%;
    background: var(--bg-primary-subtle) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FF7658' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.ticks-teal li::before { background-color: var(--bg-secondary-subtle); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232DD4BF' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E"); }
.ticks-violet li::before { background-color: var(--bg-level-subtle); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23BC9AFA' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E"); }

.feature-visual { position: relative; display: flex; flex-direction: column; align-items: center; }
.feature-visual::before {
    content: ""; position: absolute; inset: 0 5%; z-index: -1; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 90, 60, .16), transparent 70%); filter: blur(30px);
}
#buddies .feature-visual::before { background: radial-gradient(circle, rgba(45, 212, 191, .14), transparent 70%); }
#progress .feature-visual::before { background: radial-gradient(circle, rgba(139, 92, 246, .18), transparent 70%); }

/* ---------- Avatars (TevraAvatar / EventCard AvatarStack: 44 with a 2px card-colour ring) ---------- */
.av {
    display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%;
    border: 2px solid var(--border); background: var(--bg-raised);
    font-size: 16px; line-height: 24px; color: var(--text-primary);
}
.av-you { border-color: var(--bg-raised); background: var(--secondary); color: var(--on-primary); font-weight: 600; font-size: 14px; }
.av-more { border-color: var(--border-strong); background: var(--bg-page); color: var(--text-secondary); font-size: 14px; }
.av-sm { width: 32px; height: 32px; border-width: 1px; background: var(--bg-surface); font-size: 12px; line-height: 16px; }
.av-sm.av-you { border-color: var(--secondary); background: var(--secondary); }
.av-lg { width: 56px; height: 56px; background: linear-gradient(135deg, #3D3A80, #8B5CF6); font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.av.pop { animation: pop .6s var(--ease-spring); }
@keyframes pop { from { transform: scale(0); } }

/* ---------- Event card (EventCard.kt + Figma feed card: 370 wide, r12, padding 12, gap 12) ---------- */
.stack { position: relative; width: 370px; max-width: 100%; padding-bottom: 168px; }
.event-card {
    display: flex; flex-direction: column; gap: 12px; padding: 12px;
    border-radius: var(--r-md); border: 1px solid var(--border); background: var(--bg-surface);
    box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .8);
}
.ec-head { display: flex; align-items: center; gap: 12px; }
.ec-tile { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: var(--r-sm); background: var(--bg-page); font-size: 28px; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.ec-text { min-width: 0; }
.ec-title { font-size: 16px; line-height: 24px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; line-height: 16px; letter-spacing: .12px; color: var(--secondary-400); white-space: nowrap; }
.ec-meta b { font-weight: 600; }
.ec-meta i { width: 4px; height: 4px; border-radius: 50%; background: var(--border-strong); }
.ec-divider { height: 1px; background: var(--border); }
.ec-people { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.avatars { display: flex; }
.avatars .av + .av { margin-left: -9px; }
.lvl-pill { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--r-sm); background: var(--bg-level-subtle); color: var(--accent-500); font-weight: 500; font-size: 14px; line-height: 20px; }
.ec-progress { height: 2px; border-radius: var(--pill); background: var(--border); overflow: hidden; }
.ec-progress span { display: block; width: var(--p); height: 100%; border-radius: inherit; background: var(--neutral-500); transition: width 1.2s var(--ease-out), background-color .4s; }
.ec-foot { display: flex; align-items: center; justify-content: space-between; min-height: 32px; }
.ec-status { font-size: 14px; line-height: 20px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.join-btn { height: 32px; min-width: 101px; padding: 0 16px; }
.join-btn.joined { background: var(--bg-success-subtle); color: var(--text-success); box-shadow: none; font-weight: 500; }

.leaderboard {
    position: absolute; right: -32px; bottom: 0; width: 272px; padding: 16px;
    border-radius: var(--r-lg); border: 1px solid var(--border-strong); background: var(--bg-raised);
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .85); transform: rotate(3deg);
    transition: transform .6s var(--ease-spring);
}
.leaderboard:hover { transform: rotate(0) scale(1.03); }
.lb-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-family: var(--font-display); font-weight: 500; font-size: 16px; line-height: 24px; }
.lb-title .ic { width: 20px; height: 20px; color: var(--primary-600); }
.leaderboard ol { list-style: none; padding: 0; display: grid; gap: 8px; }
.leaderboard li { display: flex; align-items: center; gap: 10px; font-size: 14px; line-height: 20px; }
.leaderboard li b { margin-left: auto; font-weight: 600; color: var(--neutral-700); font-variant-numeric: tabular-nums; }
.rank { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.rank.r1 { background: var(--primary); color: var(--on-primary); }
.rank.r2 { background: var(--secondary); color: var(--on-primary); }
.rank.r3 { background: var(--milestone); color: var(--on-primary); }

/* ---------- Buddy discovery deck (Figma discover card: 370 wide, photo 264, r16) ---------- */
.deck { position: relative; width: 370px; max-width: 100%; height: 436px; }
.buddy-card {
    position: absolute; inset: 0; overflow: hidden;
    border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--bg-surface);
    box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .8);
    transition: transform .7s var(--ease-out), opacity .7s var(--ease-out);
    touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab;
}
.buddy-card.dragging { transition: none; cursor: grabbing; }
.buddy-card[data-pos="0"] { z-index: 3; }
.buddy-card[data-pos="1"] { z-index: 2; transform: translateY(14px) scale(.95); opacity: .7; }
.buddy-card[data-pos="2"] { z-index: 1; transform: translateY(28px) scale(.9); opacity: .4; }
.buddy-card[data-pos="3"] { transform: translateY(28px) scale(.9); opacity: 0; }
.buddy-card.out-right, .buddy-card.out-left { z-index: 4; pointer-events: none; transition: transform .7s var(--ease-out), opacity .35s ease-in; }
.buddy-card.out-right { transform: translateX(130%) rotate(18deg) !important; opacity: 0 !important; }
.buddy-card.out-left { transform: translateX(-130%) rotate(-18deg) !important; opacity: 0 !important; }
.bc-photo { position: relative; height: 264px; display: grid; place-items: center; background: var(--bg-raised); }
.bc-initials { display: grid; place-items: center; width: 80px; height: 80px; border-radius: 50%; background: var(--bg-surface); font-family: var(--font-display); font-weight: 600; font-size: 36px; line-height: 44px; color: var(--border-strong); }
.bc-photo .hex-chip { position: absolute; top: 8px; right: 8px; }
.bc-stamp { position: absolute; top: 24px; padding: 4px 12px; border-radius: var(--r-sm); border: 3px solid; font-family: var(--font-display); font-weight: 600; font-size: 20px; line-height: 28px; letter-spacing: .08em; opacity: 0; }
.bc-stamp.like { left: 20px; color: var(--secondary); transform: rotate(-12deg); }
.bc-stamp.nope { right: 76px; color: var(--primary); transform: rotate(12deg); }
.bc-body { padding: 12px 12px 4px; }
.bc-name { margin-bottom: 12px; font-family: var(--font-display); font-weight: 500; font-size: 20px; line-height: 28px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-name span { font-family: var(--font-body); font-weight: 400; font-size: 18px; color: var(--text-secondary); }
.bc-sports { display: flex; flex-wrap: nowrap; gap: 8px; margin-bottom: 16px; overflow: hidden; }
.bc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bc-stats div { padding: 9px 16px; border-radius: var(--r-md); background: var(--bg-subtle); }
.bc-stats small { display: block; font-size: 14px; line-height: 20px; color: var(--text-secondary); }
.bc-stats b { display: block; font-family: var(--font-display); font-weight: 500; font-size: 20px; line-height: 28px; }
.deck-actions { position: relative; z-index: 5; display: grid; grid-template-columns: 120px 1fr; gap: 12px; width: 370px; max-width: 100%; margin-top: 24px; }
.deck-hint { margin-top: 24px; font-size: 14px; line-height: 20px; color: var(--text-secondary); text-align: center; }
.deck-toast {
    position: absolute; left: 50%; top: 40%; z-index: 5; translate: -50% 0;
    padding: 10px 18px; border-radius: var(--pill); background: var(--secondary); color: var(--on-primary);
    font-family: var(--font-display); font-weight: 600; font-size: 15px; white-space: nowrap;
    animation: toast-pop 1.6s var(--ease-out) forwards; pointer-events: none;
}
@keyframes toast-pop { 0% { opacity: 0; transform: scale(.6); } 15% { opacity: 1; transform: scale(1.05); } 25% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px); } }

/* ---------- Profile + streak (Figma profile header: 370 wide, r16, padding 16) ---------- */
.profile-card, .streak-card { width: 370px; max-width: 100%; border-radius: var(--r-lg); background: var(--bg-surface); }
.profile-card { display: flex; flex-direction: column; gap: 12px; padding: 16px 16px 12px; border: 1px solid var(--border); box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .8); }
.pc-head { display: flex; align-items: center; gap: 12px; }
.pc-name { flex: 1; min-width: 0; font-family: var(--font-display); font-weight: 600; font-size: 16px; line-height: 24px; }
.pc-level { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pc-tier { font-weight: 600; font-size: 12px; line-height: 16px; letter-spacing: .12px; color: var(--primary-600); }
.pc-points { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pill-outline { display: inline-block; height: 28px; padding: 3px 16px; border-radius: var(--pill); border: 1px solid var(--border-strong); font-size: 14px; line-height: 20px; font-variant-numeric: tabular-nums; }
.pc-next { font-size: 14px; line-height: 20px; color: var(--text-secondary); }
.pc-progress { margin-top: -4px; height: 4px; border-radius: var(--pill); background: var(--bg-page); overflow: hidden; }
.pc-progress span { display: block; width: var(--p); height: 100%; border-radius: inherit; background: var(--primary-600); transform-origin: left; transition: transform 1.6s var(--ease-out) .4s; }
.js .pc-progress span { transform: scaleX(0); }
.js .in .pc-progress span { transform: none; }

.streak-card { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px; border: 1px solid var(--secondary); }
.streak-ic { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--secondary-100); color: var(--secondary); }
.streak-ic .ic { fill: currentColor; }
.streak-title { font-size: 16px; line-height: 24px; color: var(--text-primary); }
.streak-sub { font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.streak-card-sm { width: auto; margin: 0; padding: 10px 16px 10px 10px; }
.in .streak-card { animation: streak-glow 2.4s ease-in-out infinite; }
@keyframes streak-glow { 50% { box-shadow: 0 0 40px -6px rgba(45, 212, 191, .45); } }
.week-dots { display: flex; gap: 8px; margin-top: 20px; }
.week-dots span { width: 34px; height: 6px; border-radius: var(--pill); background: var(--secondary); transform-origin: left; transition: transform .5s var(--ease-out); transition-delay: calc(var(--i, 0) * 120ms + 400ms); }
.js .week-dots span { transform: scaleX(0); }
.js .in .week-dots span, .js .week-dots.in span { transform: none; }
.week-dots .now { background: var(--text-secondary-accent); }
.week-dots .off { background: var(--bg-raised); }

/* ---------- How ---------- */
.how { max-width: var(--max); margin: 0 auto; padding: clamp(88px, 10vw, 140px) var(--gutter); }
.how .h1 { max-width: 16em; margin-bottom: 56px; }
.steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step {
    position: relative; overflow: hidden; padding: 32px 28px; border-radius: 24px;
    border: 1px solid var(--border); background: linear-gradient(180deg, var(--bg-surface), var(--bg-subtle));
    transition: transform .5s var(--ease-out), border-color .3s;
}
.step::after { content: ""; position: absolute; right: -40%; bottom: -60%; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 90, 60, .14), transparent 70%); opacity: 0; transition: opacity .4s; }
.step:hover { transform: translateY(-6px); border-color: var(--border-strong); }
.step:hover::after { opacity: 1; }
.step-n { position: absolute; top: 24px; right: 28px; font-family: var(--font-display); font-weight: 600; font-size: 44px; line-height: 1; color: var(--bg-raised); }
.step .ic { width: 44px; height: 44px; margin-bottom: 28px; color: var(--primary-600); }
.step:nth-child(2) .ic { color: var(--secondary); }
.step:nth-child(3) .ic { color: var(--accent-400); }
.step .h3 { margin-bottom: 8px; }
.step p { font-size: 15px; line-height: 24px; color: var(--text-secondary); }
.js .ic.draw path { stroke-dasharray: 120; stroke-dashoffset: 120; transition: stroke-dashoffset 1.8s var(--ease-out) .3s; }
.js .in .ic.draw path, .js .in.step .ic.draw path { stroke-dashoffset: 0; }

/* ---------- CTA ---------- */
.cta { padding: 40px var(--gutter) clamp(80px, 10vw, 120px); }
.cta-card {
    position: relative; overflow: hidden; isolation: isolate;
    max-width: var(--max); margin: 0 auto; padding: clamp(56px, 8vw, 110px) 24px;
    border-radius: 32px; border: 1px solid var(--border); background-color: var(--bg-page);
    /* Safari does not clip animated, blended children with overflow + radius; clip-path does. */
    clip-path: inset(0 round 32px); -webkit-clip-path: inset(0 round 32px);
}
.cta-card .pattern { z-index: -2; animation-duration: 90s; }
.cta-glow { position: absolute; inset: 0; z-index: -1; background: radial-gradient(60% 80% at 50% 110%, rgba(255, 90, 60, .35), transparent 70%), radial-gradient(40% 60% at 10% 0%, rgba(139, 92, 246, .2), transparent 70%); }
.cta-card .lead { margin-top: 16px; }
.store-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 40px; }
.store-btn {
    position: relative; display: inline-flex; align-items: center; gap: 12px; min-width: 208px; height: 60px; padding: 0 22px;
    border-radius: var(--r-lg); background: var(--text-primary); color: var(--bg-page);
    transition: transform .3s var(--ease-spring), box-shadow .3s;
}
a.store-btn:hover { transform: translateY(-3px); box-shadow: 0 16px 40px -12px rgba(244, 246, 248, .35); }
.store-btn svg { width: 26px; height: 26px; flex: none; }
.store-btn span { display: flex; flex-direction: column; font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 1.15; }
.store-btn small { font-family: var(--font-body); font-weight: 500; font-size: 11px; line-height: 14px; opacity: .7; }
.store-btn.is-soon { background: transparent; color: var(--text-secondary); border: 1px dashed var(--border-strong); cursor: default; }
.soon-badge { position: absolute; top: -10px; right: -8px; padding: 2px 10px; border-radius: var(--pill); background: var(--bg-level-subtle); color: var(--accent-400); font-style: normal; font-weight: 600; font-size: 11px; line-height: 18px; letter-spacing: .06em; text-transform: uppercase; border: 1px solid rgba(139, 92, 246, .4); }
.store-btn-web { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-strong); }
.store-btn-web img { width: 26px; height: 26px; border-radius: 7px; flex: none; }
a.store-btn-web:hover { box-shadow: 0 16px 40px -12px rgba(255, 90, 60, .35); border-color: var(--primary); }

/* ---------- Footer ---------- */
.footer {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px;
    max-width: var(--max); margin: 0 auto; padding: 32px var(--gutter) calc(48px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border); font-size: 14px; line-height: 20px;
}
.footer-copy { color: var(--text-secondary); }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 24px; color: var(--text-secondary); }
.footer-links a { transition: color .2s; }
.footer-links a:hover { color: var(--text-primary); }

/* ---------- Brand mark (branding/app-icon) ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; }
.footer .brand-mark { width: 28px; height: 28px; }

/* ---------- Legal pages ---------- */
.legal { max-width: var(--max); margin: 0 auto; padding: 136px var(--gutter) 96px; }
.legal-head { max-width: 760px; padding-bottom: 40px; margin-bottom: 48px; border-bottom: 1px solid var(--border); }
.legal-head .h1 { margin-bottom: 12px; }
.legal-meta { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 24px 0 0; font-size: 14px; line-height: 20px; }
.legal-meta div { display: flex; gap: 8px; }
.legal-meta dt { color: var(--text-muted); }
.legal-meta dd { margin: 0; color: var(--neutral-700); }
.legal-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 64px; align-items: start; }
.legal-toc { position: sticky; top: 100px; max-height: calc(100vh - 124px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.legal-meta a { color: var(--primary-700); text-decoration: underline; text-decoration-color: rgba(255, 144, 117, .4); text-underline-offset: 3px; }
.legal-toc-title { margin-bottom: 12px; font-weight: 600; font-size: 12px; line-height: 16px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.legal-toc ol { list-style: none; padding: 0; display: grid; gap: 2px; counter-reset: toc; }
.legal-toc li { counter-increment: toc; }
.legal-toc a { display: flex; gap: 10px; padding: 6px 12px; border-radius: var(--r-sm); font-size: 14px; line-height: 20px; color: var(--text-secondary); transition: background-color .2s, color .2s; }
.legal-toc a::before { content: counter(toc); min-width: 16px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.legal-toc a:hover { background: var(--bg-surface); color: var(--text-primary); }
.legal-body { max-width: 720px; }
.legal-body section { padding-bottom: 40px; margin-bottom: 40px; border-bottom: 1px solid var(--border); scroll-margin-top: 100px; }
.legal-body section:last-child { border-bottom: 0; margin-bottom: 0; }
.legal-body h2 { margin-bottom: 16px; font-family: var(--font-display); font-weight: 600; font-size: 24px; line-height: 32px; letter-spacing: -.2px; }
.legal-body h3 { margin: 28px 0 8px; font-family: var(--font-display); font-weight: 500; font-size: 17px; line-height: 24px; color: var(--text-primary); }
.legal-body p, .legal-body li { font-size: 16px; line-height: 26px; color: var(--text-secondary); }
.legal-body p + p { margin-top: 14px; }
.legal-body ul { display: grid; gap: 8px; margin: 14px 0; padding-left: 22px; }
.legal-body li::marker { color: var(--primary-600); }
.legal-body a { color: var(--primary-700); text-decoration: underline; text-decoration-color: rgba(255, 144, 117, .4); text-underline-offset: 3px; }
.legal-body a:hover { text-decoration-color: currentColor; }
.legal-callout { margin-top: 24px !important; padding: 16px 20px; border-radius: var(--r-lg); border: 1px solid var(--secondary-100); background: var(--bg-secondary-subtle); color: var(--text-secondary-accent) !important; }
.legal-body p.legal-tag { display: inline-block; margin-bottom: 12px; padding: 2px 10px; border-radius: var(--pill); background: var(--bg-primary-subtle); color: var(--primary-700); font-weight: 600; font-size: 12px; line-height: 20px; letter-spacing: .04em; }
.legal-contact { display: grid; gap: 12px; margin: 0; }
.legal-contact div { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; padding: 14px 16px; border-radius: var(--r-md); background: var(--bg-surface); border: 1px solid var(--border); font-size: 15px; line-height: 22px; }
.legal-contact dt { color: var(--text-muted); }
.legal-contact dd { margin: 0; color: var(--text-primary); }
@media (max-width: 960px) {
    .legal-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
    .legal-toc { position: static; max-height: none; padding: 16px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--bg-surface); }
}
@media (max-width: 560px) {
    .legal { padding-top: 112px; }
    .legal-contact div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* ---------- Scroll reveal (only hidden when JS runs, so no-JS and crawlers see everything) ---------- */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); transition-delay: var(--d, 0ms); }
.js .reveal-scale { opacity: 0; transform: translateY(40px) scale(.94); transition: opacity 1.1s var(--ease-out), transform 1.1s var(--ease-out); }
.js .reveal.in, .js .reveal-scale.in { opacity: 1; transform: none; }
.no-js .word > span { transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
    .leaderboard { right: -8px; }
    .float-3 { right: -2%; }
}
@media (max-width: 960px) {
    .nav-links { display: none; }
    .hero { grid-template-columns: minmax(0, 1fr); text-align: center; padding-top: 120px; gap: 56px; }
    .hero-copy .lead { margin-inline: auto; }
    .cta-row, .hero-proof { justify-content: center; }
    .feature { grid-template-columns: minmax(0, 1fr); }
    .feature-flip .feature-copy { order: 0; }
    .steps { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .nav { top: 10px; left: 16px; right: 16px; height: 56px; padding-left: 20px; }
    .cta-row .btn { flex: 1 1 100%; }
    .phone { --screen-w: 266px; border-radius: 46px; padding: 10px; }
    .screen { border-radius: 36px; clip-path: inset(0 round 36px); }
    .phone-island { top: calc(10px + var(--screen-w) * 11 / 402); }
    .float-1 { left: -2px; top: 10%; }
    .float-2 { right: 0; top: 0; }
    .float-3 { right: -2px; bottom: 20%; }
    .float-4, .float-5 { display: none; }
    .toast { min-height: 52px; padding: 8px 12px; }
    .stack { padding-bottom: 0; }
    .leaderboard { position: relative; right: auto; width: 100%; margin-top: 16px; transform: none; }
    .store-btn { width: 100%; }
    .footer { flex-direction: column; text-align: center; }
    .footer-links { justify-content: center; }
}
@media (max-width: 380px) {
    .bc-stats div { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
}
