:root {
  --bg: #150f29; --bg2: #1f1640; --card: #fff; --ink: #1a1430; --muted: #8a82a8;
  --pink: #ff5d8f; --pink-deep: #ff3d7f; --green: #2fd093; --gold: #ffd36e;
  --lilac: #b69cff; --blue: #7fb8ff;
  --shadow: 0 30px 60px -20px rgba(0,0,0,.55); --radius: 28px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; font-family: Inter, system-ui, sans-serif; color: #fff; background: var(--bg); overflow: hidden; overscroll-behavior: none; }
body {
  background:
    radial-gradient(120% 80% at 12% -10%, #3a1f5e 0%, transparent 55%),
    radial-gradient(120% 90% at 95% 5%, #5a2350 0%, transparent 50%),
    radial-gradient(140% 120% at 50% 110%, #2a1850 0%, transparent 60%),
    linear-gradient(165deg, #150f29 0%, #1a1138 100%);
}
#app { height: 100dvh; height: 100svh; display: flex; flex-direction: column; }
#main { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* login */
.login-wrap { height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(20px); border-radius: 32px; padding: 40px 30px; box-shadow: var(--shadow); text-align: center; animation: rise .6s cubic-bezier(.2,.8,.2,1) both; }
.brand { font-family: Fraunces, serif; font-weight: 600; font-size: 40px; letter-spacing: -1px; margin: 0 0 4px; background: linear-gradient(100deg, #fff 10%, var(--gold) 55%, var(--pink) 95%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.brand .heart { -webkit-text-fill-color: initial; }
.tag { color: var(--muted); font-size: 14.5px; margin: 0 0 28px; }
.field { text-align: left; margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--lilac); margin: 0 0 6px 4px; letter-spacing: .3px; text-transform: uppercase; }
.field input { width: 100%; padding: 15px 16px; font-size: 16px; background: rgba(255,255,255,.07); color: #fff; border: 1px solid rgba(255,255,255,.14); border-radius: 16px; outline: none; transition: border-color .2s, background .2s; }
.field input:focus { border-color: var(--pink); background: rgba(255,255,255,.1); }
.btn { width: 100%; padding: 16px; margin-top: 8px; font-size: 16px; font-weight: 700; color: #fff; cursor: pointer; background: linear-gradient(100deg, var(--pink-deep), #ff8a5d); border: none; border-radius: 16px; box-shadow: 0 12px 30px -8px rgba(255,61,127,.6); transition: transform .15s; }
.btn:active { transform: scale(.97); }
.btn-ghost { width: 100%; padding: 13px; margin-top: 10px; font-size: 14px; font-weight: 600; color: var(--muted); background: transparent; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; cursor: pointer; }
.err { color: #ff9bb5; font-size: 13.5px; min-height: 18px; margin-top: 12px; }

/* topbar */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right)) 6px calc(18px + env(safe-area-inset-left)); flex-shrink: 0; }
.topbar .logo { font-family: Fraunces, serif; font-weight: 600; font-size: 22px; letter-spacing: -.5px; }
.who { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 9px; }
.who b { color: #fff; font-weight: 600; }
.icon-btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: #fff; border-radius: 11px; padding: 7px 10px; font-size: 13px; cursor: pointer; }

/* tabs */
.tabs { display: flex; gap: 5px; padding: 4px 14px 8px; flex-shrink: 0; }
.tab { flex: 1; text-align: center; padding: 9px 4px; border-radius: 13px; font-size: 13px; font-weight: 600; color: var(--muted); background: transparent; border: none; cursor: pointer; transition: color .2s, background .2s; }
.tab.active { color: #fff; background: rgba(255,255,255,.09); }
.tab .badge { display: inline-block; min-width: 17px; padding: 0 5px; margin-left: 4px; font-size: 11px; line-height: 17px; border-radius: 9px; background: var(--pink-deep); color: #fff; font-weight: 700; vertical-align: middle; }

/* filter bar */
.filterbar { display: flex; gap: 6px; justify-content: center; padding: 2px 12px 10px; flex-shrink: 0; }
.pill { padding: 8px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: var(--muted); transition: all .2s; }
.pill.active { color: #1a1430; background: #fff; border-color: #fff; }
.pill.boy.active { background: var(--blue); border-color: var(--blue); }
.pill.girl.active { background: var(--pink); border-color: var(--pink); color: #fff; }

/* deck */
.deck-area { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; padding: 0 18px 6px; min-height: 0; }
.deck { position: relative; width: 100%; max-width: 380px; height: 100%; max-height: 620px; }
.swipe-card { position: absolute; inset: 0; border-radius: var(--radius); color: var(--ink); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; will-change: transform; touch-action: none; border: 1px solid rgba(0,0,0,.04); }
.card-body { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; padding: 26px; z-index: 2; }
.card-rank { position: absolute; top: 20px; left: 22px; z-index: 3; font-size: 12px; font-weight: 700; letter-spacing: .5px; color: rgba(0,0,0,.4); background: rgba(255,255,255,.55); padding: 5px 11px; border-radius: 999px; backdrop-filter: blur(4px); }
.card-gender { position: absolute; top: 18px; right: 20px; z-index: 3; font-size: 19px; width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.55); backdrop-filter: blur(4px); }
.card-name { font-family: Fraunces, serif; font-weight: 600; font-size: clamp(46px, 13vw, 66px); line-height: .98; letter-spacing: -1.5px; margin: 0; }
.card-surname { font-family: Fraunces, serif; font-size: 19px; color: rgba(0,0,0,.5); margin-top: 4px; font-weight: 500; }
.card-meaning { font-size: 16.5px; line-height: 1.4; margin: 12px 0 0; color: rgba(0,0,0,.62); font-weight: 500; }
.card-meaning.dim { opacity: .5; }
.card-tags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.ctag { font-size: 11.5px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: rgba(0,0,0,.5); background: rgba(0,0,0,.06); padding: 4px 10px; border-radius: 999px; }
.card-spark { margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.sparkbars { font-size: 17px; line-height: 1; letter-spacing: 1px; color: rgba(0,0,0,.55); font-family: monospace; }
.sparklbl { font-size: 11px; color: rgba(0,0,0,.4); font-weight: 600; }

/* stamps */
.stamp { position: absolute; top: 34px; z-index: 4; font-family: Fraunces, serif; font-weight: 700; font-size: 32px; letter-spacing: 1px; padding: 6px 16px; border-radius: 14px; opacity: 0; border: 4px solid; text-transform: uppercase; pointer-events: none; }
.stamp.like { left: 24px; color: var(--green); border-color: var(--green); transform: rotate(-16deg); }
.stamp.nope { right: 24px; color: var(--pink-deep); border-color: var(--pink-deep); transform: rotate(16deg); }
.stamp.super { left: 50%; transform: translateX(-50%) rotate(-4deg); top: 28px; color: #8a5cff; border-color: #8a5cff; }

/* action buttons */
.actions { display: flex; gap: 16px; justify-content: center; align-items: center; padding: 10px 0 calc(14px + env(safe-area-inset-bottom)); flex-shrink: 0; }
.fab { width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer; font-size: 24px; display: flex; align-items: center; justify-content: center; color: #fff; box-shadow: 0 14px 28px -10px rgba(0,0,0,.6); transition: transform .15s; }
.fab:active { transform: scale(.88); }
.fab.nope { background: linear-gradient(145deg, #ff5d8f, #ff3d5f); }
.fab.like { background: linear-gradient(145deg, #2fd093, #28b9b0); width: 66px; height: 66px; font-size: 28px; }
.fab.star { background: linear-gradient(145deg, #b69cff, #8a5cff); font-size: 22px; }
.fab.undo { width: 48px; height: 48px; font-size: 18px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.16); }

/* lists */
.list-area { flex: 1; overflow-y: auto; padding: 4px 16px 30px; -webkit-overflow-scrolling: touch; }
.list-area::-webkit-scrollbar { width: 0; }
.empty { text-align: center; color: var(--muted); margin-top: 50px; padding: 0 30px; }
.empty .big { font-size: 52px; margin-bottom: 14px; }
.empty .big2 { font-family: Fraunces, serif; font-size: 22px; color: #fff; margin-bottom: 8px; }
.row { display: flex; align-items: center; gap: 13px; padding: 14px 16px; margin-bottom: 9px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09); border-radius: 18px; animation: rise .4s ease both; }
.row.match { background: linear-gradient(100deg, rgba(255,93,143,.16), rgba(255,211,110,.12)); border-color: rgba(255,93,143,.3); }
.row.star { background: linear-gradient(100deg, rgba(138,92,255,.18), rgba(182,156,255,.1)); border-color: rgba(138,92,255,.32); }
.row .em { font-size: 23px; }
.row .info { flex: 1; min-width: 0; }
.row .nm { font-family: Fraunces, serif; font-size: 20px; font-weight: 600; }
.row .mn { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .rspark { font-family: monospace; font-size: 13px; color: rgba(255,255,255,.35); letter-spacing: .5px; }
.row .gtag { font-size: 17px; }
.row.prow { background: linear-gradient(100deg, rgba(127,184,255,.12), rgba(255,93,143,.1)); border-color: rgba(127,184,255,.26); }
.p-like, .p-pass { width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; font-size: 17px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #fff; border: 1px solid rgba(255,255,255,.15); transition: transform .12s; }
.p-like:active, .p-pass:active { transform: scale(.85); }
.p-like { background: linear-gradient(145deg, #2fd093, #28b9b0); border-color: transparent; }
.p-pass { background: rgba(255,255,255,.08); }
.section-label { font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--lilac); margin: 22px 6px 12px; }

/* stats */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09); border-radius: 18px; padding: 18px 10px; text-align: center; }
.stat.hl { background: linear-gradient(135deg, rgba(255,93,143,.2), rgba(255,211,110,.14)); border-color: rgba(255,93,143,.3); }
.snum { font-family: Fraunces, serif; font-size: 26px; font-weight: 700; }
.slbl { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.prog-wrap { margin: 22px 4px 6px; }
.prog-lbl { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.prog-bar { height: 10px; background: rgba(255,255,255,.08); border-radius: 999px; overflow: hidden; }
.prog-fill { height: 100%; background: linear-gradient(90deg, var(--pink), var(--gold)); border-radius: 999px; transition: width .6s; }
.surname-card { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09); border-radius: 18px; padding: 16px; }
.sc-lbl { font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.sc-row { display: flex; gap: 8px; margin-top: 12px; }
.sc-row input { flex: 1; padding: 12px 14px; font-size: 15px; background: rgba(255,255,255,.07); color: #fff; border: 1px solid rgba(255,255,255,.14); border-radius: 13px; outline: none; }
.sc-row input:focus { border-color: var(--pink); }
.btn-sm { padding: 0 18px; font-weight: 700; color: #fff; background: linear-gradient(100deg, var(--pink-deep), #ff8a5d); border: none; border-radius: 13px; cursor: pointer; }
.sc-eg { font-size: 13px; color: var(--muted); margin-top: 12px; }
.sc-eg b { color: #fff; font-family: Fraunces, serif; }

/* sheets (search + filter) */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(15,9,30,.6); backdrop-filter: blur(6px); display: flex; align-items: flex-end; animation: fade .25s ease; }
.sheet-inner { width: 100%; max-height: 88dvh; overflow-y: auto; background: linear-gradient(180deg, #251a47, #1c1338); border-radius: 26px 26px 0 0; padding: 20px 18px 30px; border-top: 1px solid rgba(255,255,255,.12); animation: sheetUp .35s cubic-bezier(.2,.8,.2,1); }
.sheet-inner::-webkit-scrollbar { width: 0; }
.search-sheet { max-height: 90dvh; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-size: 17px; }
.search-input { width: 100%; padding: 15px 16px; font-size: 16px; background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.16); border-radius: 15px; outline: none; }
.search-input:focus { border-color: var(--pink); }
.search-res { margin-top: 12px; }
.srow { display: flex; align-items: center; gap: 10px; padding: 11px 12px; margin-bottom: 7px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; }
.srow .info { flex: 1; min-width: 0; }
.srow .nm { font-family: Fraunces, serif; font-size: 18px; font-weight: 600; }
.srow .mn { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-like, .s-star { padding: 8px 12px; font-size: 13px; font-weight: 700; color: #fff; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); border-radius: 11px; cursor: pointer; white-space: nowrap; }
.s-star.done { background: linear-gradient(145deg, #b69cff, #8a5cff); border-color: transparent; }
.s-like.done { background: linear-gradient(145deg, #2fd093, #28b9b0); border-color: transparent; }

/* filter chips */
.fgroup { margin-bottom: 18px; }
.flbl { font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--lilac); margin-bottom: 9px; }
.fchips { display: flex; flex-wrap: wrap; gap: 7px; }
.fchips.letters { gap: 5px; }
.fchip { padding: 8px 13px; font-size: 13px; font-weight: 600; color: var(--muted); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; cursor: pointer; transition: all .15s; }
.fchips.letters .fchip { padding: 7px 0; width: 34px; text-align: center; }
.fchip.on { color: #1a1430; background: #fff; border-color: #fff; }

/* celebration */
.celebrate { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; background: rgba(15,9,30,.82); backdrop-filter: blur(8px); animation: fade .3s ease; }
.celebrate .pop { animation: pop .5s cubic-bezier(.2,1.2,.3,1) both; text-align: center; }
.celebrate .its { font-family: Fraunces, serif; font-size: 26px; color: var(--gold); letter-spacing: .5px; }
.celebrate .mname { font-family: Fraunces, serif; font-weight: 700; font-size: clamp(56px, 20vw, 96px); line-height: 1; margin: 6px 0 4px; background: linear-gradient(100deg, #fff, var(--pink) 60%, var(--gold)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.celebrate .sub { color: #fff; font-size: 16px; opacity: .85; }
.celebrate .tapaway { margin-top: 30px; color: var(--muted); font-size: 13px; }
.confetti { position: fixed; top: -10px; width: 10px; height: 14px; z-index: 49; pointer-events: none; border-radius: 2px; }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .9; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 30px; height: 30px; border: 3px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
