/* LIFE 360 — mobile-first styles. No build step: this file is served as is. */
:root {
    --black: #080B12; --navy: #101827; --navy-2: #172238; --line: rgba(212, 175, 55, .2);
    --gold: #D4AF37; --champagne: #F5D98A; --green: #21C98B; --blue: #397CF5;
    --white: #F4F6FA; --muted: #9BA6BC; --amber: #F4A640; --red: #E45B65;
    --radius: 16px; --tabs-h: 64px;
    --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
    --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--black); color: var(--white);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow-x: hidden; overflow-wrap: anywhere; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p, dl, dd, ol { margin: 0; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
a { color: var(--champagne); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--champagne); outline-offset: 2px; border-radius: 6px; }
.icon { flex: none; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--gold); color: #000; padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- Buttons and forms ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
    border-radius: 12px; border: 1px solid transparent; font: inherit; font-weight: 650; text-decoration: none;
    cursor: pointer; transition: transform .15s ease, filter .15s ease, background .15s ease; touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn.gold { background: linear-gradient(180deg, var(--champagne), var(--gold)); color: #1a1405; }
.btn.gold:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--white); }
.btn.ghost:hover { background: rgba(255, 255, 255, .05); }
.btn.danger { background: transparent; border-color: rgba(228, 91, 101, .5); color: var(--red); }
.btn.link { background: none; color: var(--champagne); padding: 0 8px; }
.btn.small { min-height: 44px; padding: 0 16px; font-size: .94rem; }
.btn.block { display: flex; width: 100%; margin-top: 16px; }
form[data-busy] button { opacity: .55; pointer-events: none; }
label { display: block; margin: 14px 0 6px; font-size: .9rem; color: var(--muted); }
label small { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
    width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
    background: var(--black); color: var(--white); font: inherit; font-size: 16px; /* 16px stops iOS zooming on focus */
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }

/* ---------- Shared pieces ---------- */
.card, .card-flush { background: linear-gradient(180deg, var(--navy-2), var(--navy)); border: 1px solid var(--line); border-radius: var(--radius); }
.card { padding: 16px; }
.card > h2 { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; color: var(--champagne); margin-bottom: 12px; }
.card > * + * { margin-top: 10px; }
.hint, .fineprint, .empty { color: var(--muted); font-size: .86rem; }
.fineprint { text-align: center; padding: 20px 8px 4px; }
.pos { color: var(--green); } .neg { color: var(--red); }
.warn-text { color: var(--amber); font-size: .9rem; }
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-size: .95rem; animation: rise .3s ease both; }
.flash.ok { background: rgba(33, 201, 139, .13); border: 1px solid rgba(33, 201, 139, .4); }
.flash.err { background: rgba(228, 91, 101, .13); border: 1px solid rgba(228, 91, 101, .45); }
.facts > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); font-size: .92rem; }
.facts dd { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 650; background: rgba(255, 255, 255, .08); }
.pill.offer, .pill.accepted { background: rgba(33, 201, 139, .18); color: var(--green); }
.pill.rejected { background: rgba(228, 91, 101, .16); color: var(--red); }
.pill.pending { background: rgba(244, 166, 64, .16); color: var(--amber); }

.meter + .meter { margin-top: 12px; }
.meter-top { display: flex; justify-content: space-between; font-size: .92rem; margin-bottom: 5px; }
.meter-top small { color: var(--muted); font-weight: 400; }
.meter-bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .09); overflow: hidden; }
.meter-bar i { display: block; height: 100%; border-radius: 99px; background: var(--gold); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.meter-bar i.green { background: var(--green); } .meter-bar i.blue { background: var(--blue); } .meter-bar i.red { background: var(--red); }

/* ---------- Game shell ---------- */
.topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: calc(10px + var(--safe-t)) calc(16px + var(--safe-r)) 10px calc(16px + var(--safe-l));
    background: rgba(8, 11, 18, .88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.brand, .logo { font-family: Georgia, "Times New Roman", serif; font-weight: 700; letter-spacing: .08em; color: var(--white); text-decoration: none; }
.brand { font-size: 1.15rem; white-space: nowrap; }
.brand span, .logo span { color: var(--gold); }
.topbar-money { display: flex; gap: 18px; text-align: right; }
.topbar-money small { display: block; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.topbar-money b { font-variant-numeric: tabular-nums; font-size: .98rem; color: var(--champagne); }
.main { padding: 12px calc(14px + var(--safe-r)) calc(var(--tabs-h) + var(--safe-b) + 20px) calc(14px + var(--safe-l)); max-width: 1120px; margin: 0 auto; }
.datebar { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .84rem; margin-bottom: 12px; }
.page-title { font-size: 1.5rem; margin-bottom: 12px; }
.section-title { font-size: 1.05rem; color: var(--champagne); margin: 20px 0 10px; }
.main > section + section, .grid > * + * { margin-top: 12px; }

.tabs {
    position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
    height: calc(var(--tabs-h) + var(--safe-b)); padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
    background: rgba(12, 17, 28, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; color: var(--muted); text-decoration: none; font-size: .72rem; position: relative; }
.tab.active { color: var(--champagne); }
.tab.active::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--gold); }
.tab.wide-only { display: none; }

/* ---------- Home ---------- */
.scene { position: relative; overflow: hidden; min-height: 220px; }
.scene-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene-info { position: relative; padding: 126px 16px 14px; background: linear-gradient(180deg, transparent 30%, rgba(8, 11, 18, .9) 82%); }
.scene-info h1 { font-size: 1.45rem; }
.scene-info p { color: var(--muted); font-size: .92rem; }
.xp { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: .8rem; color: var(--champagne); }
.xp .meter-bar { flex: 1; height: 6px; }
.clouds { animation: drift 60s linear infinite alternate; }
.windows rect:nth-child(3n) { animation: twinkle 5s ease-in-out infinite; }
.windows rect:nth-child(4n) { animation: twinkle 7s ease-in-out 1s infinite; }
.notice { border-color: rgba(33, 201, 139, .5); }
.actions { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.act {
    display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 92px; padding: 10px 6px; text-align: center;
    border-radius: 14px; border: 1px solid var(--line); background: var(--black); color: var(--white); font: inherit; cursor: pointer;
    grid-column: span 2; transition: transform .15s ease, border-color .15s ease; touch-action: manipulation;
}
.act:hover { border-color: var(--gold); } .act:active { transform: scale(.96); }
.act .icon { color: var(--gold); }
.act b { font-size: .92rem; } .act small { color: var(--muted); font-size: .72rem; line-height: 1.25; }
.act.slim { grid-column: span 3; flex-direction: row; justify-content: center; min-height: 48px; gap: 8px; }
.tip { padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); border-left: 3px solid var(--blue); }
.tip + .tip { margin-top: 8px; }
.tip.risk { border-left-color: var(--red); } .tip.warn { border-left-color: var(--amber); } .tip.good { border-left-color: var(--green); }
.tip p { color: #cfd6e4; font-size: .92rem; margin-top: 2px; }
.event { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.event:last-child { border-bottom: 0; }
.event small { color: var(--muted); font-size: .74rem; }
.event p { font-size: .92rem; } .event b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.event.warning p { color: var(--amber); }

/* ---------- Lists: career, education, bank ---------- */
.cards { display: grid; gap: 12px; }
.job header { display: flex; justify-content: space-between; gap: 12px; }
.job h3 { font-size: 1.02rem; } .job header p, .req { color: var(--muted); font-size: .86rem; }
.salary { color: var(--champagne); white-space: nowrap; font-variant-numeric: tabular-nums; } .salary small { color: var(--muted); font-weight: 400; }
.row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.row:last-child { border-bottom: 0; } .row p { color: var(--muted); font-size: .86rem; }
.row-actions { display: flex; gap: 8px; }
.bankcard { background: linear-gradient(135deg, #1d2a48, #101827 60%); border-color: rgba(212, 175, 55, .45); }
.bankcard > small { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; }
.big { font-size: 2.1rem; font-weight: 700; color: var(--champagne); font-variant-numeric: tabular-nums; }
.entry { padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); } .entry:last-child { border-bottom: 0; }
.entry-head { display: flex; justify-content: space-between; gap: 10px; } .entry-head small { color: var(--muted); white-space: nowrap; }
.entry-line { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .84rem; font-variant-numeric: tabular-nums; }
.link-list { display: grid; gap: 8px; }
.link-list a, .link-list button { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--black); color: var(--white); text-decoration: none; font: inherit; cursor: pointer; text-align: left; }

/* ---------- Guest pages ---------- */
.guest-main { max-width: 560px; margin: 0 auto; padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(32px + var(--safe-b)) calc(16px + var(--safe-l)); }
.hero { text-align: center; }
.hero-scene { height: 200px; min-height: 0; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 22px; }
.eyebrow { color: var(--muted); font-size: .76rem; letter-spacing: .2em; text-transform: uppercase; }
.logo { font-size: clamp(2.6rem, 13vw, 4rem); margin-top: 6px; }
.logo.small { font-size: 1.6rem; text-align: center; margin: 8px 0 14px; }
.tagline { color: var(--gold); letter-spacing: .28em; text-transform: uppercase; font-size: .82rem; }
.lede { color: #cfd6e4; margin: 16px auto 22px; max-width: 34em; }
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.features { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.features article { padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--navy); }
.features h2 { font-size: 1rem; color: var(--champagne); } .features p { color: var(--muted); font-size: .86rem; margin-top: 4px; }
.auth h2, .create > h2 { text-align: center; font-size: 1.25rem; margin-bottom: 8px; }
.create h3 { margin: 20px 0 10px; font-size: 1.05rem; color: var(--champagne); }
.alt, .center { text-align: center; margin-top: 16px; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scenarios { display: grid; gap: 10px; }
.scenario { margin: 0; position: relative; cursor: pointer; }
.scenario input { position: absolute; opacity: 0; inset: 0; }
.scenario-body { display: grid; gap: 2px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--navy); color: #cfd6e4; font-size: .9rem; transition: border-color .15s ease, background .15s ease; }
.scenario-body b { color: var(--white); font-size: 1rem; } .scenario-body .amount { color: var(--champagne); font-weight: 700; font-size: 1.15rem; }
.scenario-body small { color: var(--muted); }
.scenario input:checked + .scenario-body { border-color: var(--gold); background: var(--navy-2); box-shadow: 0 0 0 1px var(--gold) inset; }
.scenario input:focus-visible + .scenario-body { outline: 2px solid var(--champagne); outline-offset: 2px; }

/* ---------- Install / Open app popup ---------- */
.pwa-sheet {
    position: fixed; z-index: 60; left: 8px; right: 8px; bottom: calc(var(--tabs-h) + var(--safe-b) + 8px);
    padding: 16px; border-radius: 18px; background: #131d31; border: 1px solid var(--gold);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .65); animation: sheet .35s cubic-bezier(.2, .8, .2, 1) both;
}
.guest .pwa-sheet { bottom: calc(8px + var(--safe-b)); }
.pwa-head { display: flex; gap: 12px; align-items: center; }
.pwa-head img { border-radius: 12px; flex: none; }
.pwa-head h2 { font-size: 1.08rem; } .pwa-head p { color: #cfd6e4; font-size: .9rem; }
.pwa-steps { margin-top: 12px; padding-left: 22px; color: #cfd6e4; font-size: .92rem; } .pwa-steps li + li { margin-top: 4px; }
.pwa-hint { margin-top: 10px; color: var(--amber); font-size: .88rem; }
.pwa-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 14px; }
.pwa-reset { display: block; margin: 10px auto 0; min-height: 44px; background: none; border: 0; color: var(--muted); font: inherit; font-size: .82rem; text-decoration: underline; cursor: pointer; }
.toast {
    position: fixed; z-index: 70; left: 8px; right: 8px; top: calc(8px + var(--safe-t)); display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 14px; border-radius: 14px; background: #131d31; border: 1px solid var(--gold); box-shadow: 0 12px 30px rgba(0, 0, 0, .5); font-size: .92rem; animation: rise .3s ease both;
}
.toast.warn { border-color: var(--amber); color: var(--amber); }

@keyframes sheet { from { transform: translateY(24px); opacity: 0; } }
@keyframes rise { from { transform: translateY(-6px); opacity: 0; } }
@keyframes drift { to { transform: translateX(-40px); } }
@keyframes twinkle { 50% { opacity: .25; } }

/* ---------- Tablet ---------- */
@media (min-width: 640px) {
    .cards { grid-template-columns: 1fr 1fr; }
    .scenarios { grid-template-columns: 1fr 1fr; }
    .guest-main { max-width: 720px; }
    .pwa-sheet, .toast { left: auto; right: 16px; width: 400px; }
}

/* ---------- Desktop: bottom tabs become a side rail ---------- */
@media (min-width: 960px) {
    .tabs { top: 0; right: auto; width: 220px; height: auto; flex-direction: column; justify-content: flex-start; gap: 4px; padding: 76px 12px 12px; border-top: 0; border-right: 1px solid var(--line); }
    .tab { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 12px; font-size: .96rem; }
    .tab.wide-only { display: flex; }
    .tab.active { background: rgba(212, 175, 55, .12); } .tab.active::before { display: none; }
    .topbar { padding-left: 24px; padding-right: 24px; z-index: 45; }
    .main { margin-left: 220px; padding: 20px 28px 40px; max-width: none; }
    .grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; align-items: start; }
    .grid > * + * { margin-top: 0; }
    .grid > .scene { grid-column: 1 / -1; min-height: 240px; }
    .scene-info { padding-top: 150px; }
    .cards { grid-template-columns: repeat(3, 1fr); }
    .pwa-sheet { bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Phases 2–4 ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 96px; padding: 12px 6px; text-align: center; text-decoration: none; color: var(--white); border-radius: 14px; border: 1px solid var(--line); background: linear-gradient(180deg, var(--navy-2), var(--navy)); transition: transform .15s ease, border-color .15s ease; }
.tile:hover { border-color: var(--gold); } .tile:active { transform: scale(.96); }
.tile .icon { color: var(--gold); } .tile b { font-size: .88rem; } .tile small { color: var(--muted); font-size: .7rem; line-height: 1.2; }
.rowlink { color: inherit; text-decoration: none; } .right { text-align: right; }
.row-actions.wrap { flex-wrap: wrap; } .row-actions select { flex: 1 1 100%; }
.cards.three { grid-template-columns: 1fr; }
.scenario-card h3 { font-size: 1rem; margin-bottom: 6px; }
.scenario-card.pessimistic { border-top: 3px solid var(--red); } .scenario-card.base { border-top: 3px solid var(--gold); } .scenario-card.optimistic { border-top: 3px solid var(--green); }
.plain { padding-left: 20px; color: #cfd6e4; font-size: .94rem; } .plain li + li { margin-top: 6px; }
.spark { display: block; width: 100%; height: 44px; }
.spark polyline { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark.up polyline { stroke: var(--green); } .spark.down polyline { stroke: var(--red); }
details.trade summary { list-style: none; cursor: pointer; } details.trade summary::-webkit-details-marker { display: none; }
details.trade[open] summary { margin-bottom: 4px; } details.trade .row-actions { margin-top: 12px; flex-wrap: wrap; }
.owned, .person { padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); } .owned:last-child, .person:last-child { border-bottom: 0; }
.owned > * + *, .person > * + * { margin-top: 8px; } .owned .row, .person .row { padding: 0; border: 0; }
.build { display: block; width: 100%; max-width: 420px; border-radius: 12px; border: 1px solid var(--line); }
.build.working .load { animation: hoist 2.4s ease-in-out infinite alternate; }
.pill.level-low { background: rgba(33, 201, 139, .18); color: var(--green); } .pill.level-medium { background: rgba(244, 166, 64, .16); color: var(--amber); } .pill.level-high { background: rgba(228, 91, 101, .16); color: var(--red); }
.seg { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.seg a { flex: 1 1 0; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; border-radius: 10px; border: 1px solid var(--line); color: var(--white); text-decoration: none; font-size: .88rem; white-space: nowrap; }
.seg a.active { background: var(--gold); color: #1a1405; font-weight: 650; }
.chart { display: block; width: 100%; height: auto; }
.chart .axis { stroke: rgba(255, 255, 255, .18); stroke-width: 1; } .chart text { fill: var(--muted); font-size: 8px; }
.chart polyline { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .opt { stroke: var(--green); } .chart .base { stroke: var(--gold); } .chart .pess { stroke: var(--red); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; } .dot.opt { background: var(--green); } .dot.base { background: var(--gold); } .dot.pess { background: var(--red); }
.phone { max-width: 420px; margin: 0 auto; padding: 14px; border-radius: 28px; border: 2px solid #2a3550; background: #0b101b; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); animation: sheet .35s cubic-bezier(.2, .8, .2, 1) both; }
.phone-top { display: flex; justify-content: space-between; color: var(--muted); font-size: .76rem; padding: 0 6px 10px; }
.phone h2 { font-size: .95rem; color: var(--champagne); margin: 18px 4px 8px; }
.apps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 6px; }
.app { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--white); text-decoration: none; font-size: .68rem; text-align: center; }
.app span { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; background: linear-gradient(160deg, #1f2c4a, #131c30); border: 1px solid var(--line); color: var(--gold); }
.bubble { padding: 10px 12px; border-radius: 14px 14px 14px 4px; background: var(--navy-2); font-size: .9rem; margin-bottom: 8px; }
.bubble small { display: block; color: var(--muted); font-size: .7rem; margin-bottom: 2px; } .bubble.warning { border-left: 3px solid var(--amber); } .bubble.message { border-left: 3px solid var(--red); }
@keyframes hoist { to { transform: translateY(22px); } }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(4, 1fr); } .cards.three { grid-template-columns: repeat(3, 1fr); } .row-actions select { flex: 1 1 auto; } }
@media (min-width: 960px) { .tiles { grid-template-columns: repeat(6, 1fr); } .tabs { overflow-y: auto; } }
