:root {
  --bg: #170d1a;
  --bg2: #22132a;
  --surface: #2b1a34;
  --surface2: #382244;
  --line: rgba(255,255,255,.08);
  --text: #fbeff4;
  --muted: #b9a3bf;
  --accent: #ff5a7a;
  --accent2: #ffb347;
  --ok: #3ccf91;
  --no: #8a7a91;
  --radius: 22px;
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); }
body { overscroll-behavior: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
#app { min-height: 100%; max-width: 520px; margin: 0 auto; position: relative; display: flex; flex-direction: column; }

/* ---------- Generic ---------- */
.screen { flex: 1; padding: calc(18px + var(--safe-t)) 20px calc(96px + var(--safe-b)); display: flex; flex-direction: column; gap: 16px; }
.screen.center { justify-content: center; padding-bottom: calc(32px + var(--safe-b)); }
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 30px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
p { margin: 0; line-height: 1.45; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 22px; border-radius: 999px; font-weight: 600; font-size: 16px; transition: transform .12s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #ff7b54); color: #fff; box-shadow: 0 8px 24px rgba(255,90,122,.35); }
.btn.ghost { background: var(--surface); }
.btn.line { border: 1px solid var(--line); }
.btn.danger { color: #ff8a9b; background: rgba(255,90,122,.08); }
.btn.block { width: 100%; }
.btn.sm { height: 38px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); padding-left: 4px; }
.input, textarea.input, select.input { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; font-size: 16px; outline: none; }
.input:focus { border-color: rgba(255,90,122,.6); }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.4; }

.card-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 2px 20px; }
.chips::-webkit-scrollbar { display: none; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface2); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.badge.yes { background: rgba(60,207,145,.15); color: var(--ok); }
.badge.maybe { background: rgba(255,179,71,.15); color: var(--accent2); }

.banner { background: linear-gradient(135deg, rgba(255,90,122,.16), rgba(255,179,71,.12)); border: 1px solid rgba(255,90,122,.25); border-radius: 16px; padding: 12px 14px; font-size: 14px; line-height: 1.4; }
.demo-tag { position: fixed; top: calc(8px + var(--safe-t)); right: 10px; z-index: 50; font-size: 11px; font-weight: 700; background: var(--accent2); color: #2a1500; padding: 4px 9px; border-radius: 999px; letter-spacing: .05em; }

/* ---------- Logo / welcome ---------- */
.logo { width: 84px; height: 84px; border-radius: 26px; background: radial-gradient(circle at 35% 30%, #ffd08a, var(--accent) 55%, #9b2d6a); display: grid; place-items: center; font-size: 42px; box-shadow: 0 16px 50px rgba(255,90,122,.4); }
.welcome { text-align: center; align-items: center; gap: 22px; }
.welcome h1 { font-size: 42px; }
.welcome .lead { font-size: 17px; color: var(--muted); max-width: 300px; }
.code-big { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 38px; letter-spacing: .25em; font-weight: 700; text-align: center; padding: 18px; background: var(--surface); border-radius: 18px; border: 1px dashed rgba(255,255,255,.2); }

/* ---------- Tab bar ---------- */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); padding: 8px 8px calc(8px + var(--safe-b)); background: rgba(23,13,26,.86); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 11px; color: var(--muted); position: relative; }
.tab .ic { font-size: 22px; filter: grayscale(1) opacity(.7); transition: filter .2s, transform .2s; }
.tab.on { color: var(--text); }
.tab.on .ic { filter: none; transform: translateY(-1px) scale(1.08); }
.tab .dot { position: absolute; top: 2px; right: calc(50% - 20px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

/* ---------- Header ---------- */
.head { display: flex; align-items: center; gap: 12px; }
.head .sub { font-size: 13px; color: var(--muted); }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 20px; }

/* ---------- Swipe deck ---------- */
.deck-area { position: relative; flex: 1; min-height: 400px; margin-top: 4px; }
.scard { position: absolute; inset: 0; border-radius: 28px; padding: 26px 24px; display: flex; flex-direction: column; color: #fff; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: 0 20px 50px rgba(0,0,0,.45); will-change: transform; }
.scard::before { content: ''; position: absolute; inset: 0; background: radial-gradient(120% 80% at 0% 0%, rgba(255,255,255,.22), transparent 55%), radial-gradient(90% 70% at 100% 100%, rgba(0,0,0,.35), transparent 60%); pointer-events: none; }
.scard .deckname { position: relative; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; opacity: .92; }
.scard .big-emoji { position: relative; font-size: 56px; margin-top: auto; }
.scard .text { position: relative; font-family: var(--serif); font-size: 30px; line-height: 1.15; font-weight: 600; margin: 14px 0 auto; text-wrap: balance; }
.scard .foot { position: relative; font-size: 12px; opacity: .75; display: flex; justify-content: space-between; }
.scard.back1 { transform: translateY(14px) scale(.95); opacity: .75; }
.scard.back2 { transform: translateY(28px) scale(.9); opacity: .45; }
.stamp { position: absolute; top: 34px; padding: 6px 14px; border: 3px solid; border-radius: 12px; font-weight: 800; font-size: 24px; letter-spacing: .06em; opacity: 0; transform: rotate(-12deg); }
.stamp.yes { left: 22px; color: #b9ffd9; border-color: #b9ffd9; }
.stamp.no { right: 22px; color: #fff; border-color: #fff; transform: rotate(12deg); }
.stamp.maybe { left: 50%; top: auto; bottom: 90px; transform: translateX(-50%); color: #ffe2b0; border-color: #ffe2b0; }
.actions { display: flex; justify-content: center; align-items: center; gap: 18px; padding-top: 6px; }
.act { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 22px rgba(0,0,0,.3); transition: transform .12s; }
.act:active { transform: scale(.9); }
.act.sm { width: 50px; height: 50px; font-size: 20px; }
.act.yes { background: linear-gradient(135deg, var(--accent), #ff7b54); border: 0; }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.empty .e { font-size: 48px; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.item .em { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex: none; }
.item .body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.item .t { font-size: 15px; line-height: 1.35; }
.item.done .t { text-decoration: line-through; color: var(--muted); }
.check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--muted); flex: none; display: grid; place-items: center; font-size: 14px; margin-top: 6px; }
.check.on { background: var(--ok); border-color: var(--ok); color: #06301d; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 6px; }

/* ---------- Daily ---------- */
.daily-q { background: linear-gradient(160deg, #4b2a63, #7b2f5b 60%, #b2475a); border-radius: 26px; padding: 26px 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 18px 40px rgba(0,0,0,.35); }
.daily-q .q { font-family: var(--serif); font-size: 26px; line-height: 1.2; }
.bubble { background: var(--surface); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.bubble .who { font-size: 12px; color: var(--muted); font-weight: 600; }
.bubble.locked { filter: blur(0); color: var(--muted); font-style: italic; }
.stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.stat { background: var(--surface); border-radius: 18px; padding: 14px 10px; text-align: center; }
.stat b { display: block; font-family: var(--serif); font-size: 26px; }
.stat span { font-size: 12px; color: var(--muted); }

/* ---------- Modal / overlay ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(8,3,10,.66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { width: 100%; max-width: 520px; background: var(--bg2); border-radius: 28px 28px 0 0; padding: 22px 20px calc(22px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; max-height: 92vh; overflow-y: auto; animation: up .25s cubic-bezier(.2,.9,.3,1.1); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.18); margin: -8px auto 4px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { height: 40px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--surface2); color: var(--text); }
.match-pop { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 30px; text-align: center; background: radial-gradient(circle at 50% 35%, #8e2a52, #170d1a 70%); animation: fade .25s; }
.match-pop h1 { font-size: 44px; }
.match-pop .hearts { font-size: 64px; animation: pulse 1s infinite; }
.match-pop .mtext { font-family: var(--serif); font-size: 24px; max-width: 340px; }
.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%); z-index: 80; background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: up .2s; max-width: 90vw; text-align: center; }
.loader { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface2); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 40px auto; }
.switch { width: 50px; height: 30px; border-radius: 15px; background: var(--surface2); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }

@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.15); } }
