/* Choizi v1 — Ember solid design system */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #141311;
  --bg2: #1c1b18;
  --text: #f5f1ea;
  --muted: rgba(245, 241, 234, .62);
  --faint: rgba(245, 241, 234, .42);
  --accent: #e8590c;
  --accent-soft: rgba(232, 89, 12, .14);
  --accent-text: #ffab7a;
  --glass: rgba(255, 255, 255, .06);
  --glass-border: rgba(255, 255, 255, .1);
  --danger: #ff5a5a;
  --ok: #7ee2a8;
  --radius: 18px;
  --font-d: 'Sora', -apple-system, sans-serif;
  --font-b: 'Inter', -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior-y: none;
}

body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(600px 400px at 85% -5%, rgba(232, 89, 12, .14), transparent 60%),
    radial-gradient(500px 500px at -10% 110%, rgba(232, 89, 12, .07), transparent 60%);
}

#app { position: relative; z-index: 1; max-width: 520px; margin: 0 auto; min-height: 100dvh; padding: 0 20px calc(96px + env(safe-area-inset-bottom)); }

/* ---------- type ---------- */
.wordmark { font-family: var(--font-d); font-weight: 800; font-size: 21px; letter-spacing: -.5px; }
.wordmark em { font-style: normal; color: var(--accent); }
h1.hero { font-family: var(--font-d); font-weight: 800; font-size: 32px; line-height: 1.12; letter-spacing: -.8px; margin: 14px 0 8px; }
.sub { color: var(--muted); font-size: 14px; line-height: 1.55; }
.sec-label { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--faint); margin: 22px 0 10px; }

/* ---------- glass primitives ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 14px 34px -18px rgba(0,0,0,.7);
}

/* ---------- buttons ---------- */
.btn {
  display: block; width: 100%; border: none; cursor: pointer;
  font-family: var(--font-d); font-weight: 700; font-size: 15.5px;
  padding: 17px; border-radius: 20px; color: #fff; background: var(--accent);
  box-shadow: 0 14px 30px -10px rgba(232, 89, 12, .55), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .12s ease, box-shadow .2s ease;
  letter-spacing: -.2px;
}
/* Snappy tactile press: quick dip with shadow collapse, springy release. */
.btn:active { transform: scale(.96) translateY(1px); box-shadow: 0 4px 14px -8px rgba(232, 89, 12, .5), inset 0 1px 0 rgba(255,255,255,.25); transition: transform .08s ease, box-shadow .12s ease; }
.btn:disabled { opacity: .55; }
.btn.ghost { background: var(--glass); border: 1px solid var(--glass-border); box-shadow: none; color: var(--text); font-size: 14px; padding: 14px; }
.btn.small { padding: 12px; font-size: 13.5px; border-radius: 14px; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row .btn { margin-top: 0; }

/* ---------- inputs ---------- */
.field {
  width: 100%; background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 15px 16px; color: var(--text);
  font-family: var(--font-b); font-size: 15px; outline: none;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.field::placeholder { color: var(--faint); }
.field:focus { border-color: var(--accent); }
.search-wrap { display: flex; align-items: center; gap: 10px; }
.search-wrap .field { flex: 1; }

/* ---------- chips / segmented ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; cursor: grab;
  /* Fade the right edge to hint there's more to scroll. */
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%); }
.chips::-webkit-scrollbar { display: none; }
.chips.dragging { cursor: grabbing; }
.chips.dragging .chip { pointer-events: none; }
.chip {
  flex-shrink: 0; padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--glass); border: 1px solid var(--glass-border); color: var(--text); cursor: pointer;
  transition: all .15s ease; white-space: nowrap;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg { display: flex; padding: 4px; gap: 4px; border-radius: 16px; }
.seg button { flex: 1; border: none; background: none; color: var(--muted); font-family: var(--font-b); font-weight: 600; font-size: 13px; padding: 11px 0; border-radius: 12px; cursor: pointer; }
.seg button.on { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.12); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: var(--radius); cursor: pointer; }
.toggle { width: 46px; height: 27px; border-radius: 999px; background: rgba(255,255,255,.14); position: relative; transition: background .2s; flex-shrink: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(19px); }

/* ---------- result cards ---------- */
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 12px; }
.pick { border-radius: 22px; overflow: hidden; margin-bottom: 16px; animation: rise .55s cubic-bezier(.2,.9,.25,1.15) both; perspective: 1200px; cursor: pointer; }
.pick.winner { border-color: rgba(232, 89, 12, .55); box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 14px 34px -12px rgba(232,89,12,.5); }
/* 3D flip: front = quick scan, back = full details. */
.flip-inner { display: grid; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.25,.8,.3,1.1); }
.pick.flipped .flip-inner { transform: rotateY(180deg); }
.flip-front, .flip-back { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; min-width: 0; }
.flip-back { transform: rotateY(180deg); }
.flip-hint { margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--faint); letter-spacing: .3px; }
.flip-hint-btn { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 12px; font-weight: 700; color: var(--accent-text); letter-spacing: .3px; padding: 4px 0 4px 8px; white-space: nowrap; }
.flip-section-label { margin-top: 12px; font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent-text); }
.flip-close { margin-left: auto; background: none; border: none; color: var(--faint); font-size: 16px; cursor: pointer; padding: 4px 8px; line-height: 1; }
.pick-top { margin-bottom: 10px; display: flex; align-items: center; }
.zip-note { font-size: 12px; color: var(--faint); margin: -4px 0 12px; }
.vote-promo { margin-top: 16px; padding: 16px 18px; }
.vote-promo-t { font-family: var(--font-d); font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.vote-pick-check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--glass); border: 1px solid var(--glass-border); margin-bottom: 8px; cursor: pointer; font-size: 14px; font-weight: 600; }
.vote-pick-check input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
.roulette-note { font-size: 12.5px; color: var(--faint); margin-top: 10px; }
.badge { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; padding: 6px 11px; border-radius: 999px; background: var(--accent); color: #fff; }
.badge.win { background: var(--accent); box-shadow: 0 4px 14px -4px rgba(232,89,12,.7); }
.pick-body { padding: 16px; }
.pick-name { font-family: var(--font-d); font-weight: 700; font-size: 19px; letter-spacing: -.4px; }
.pick-meta { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.pick-why { font-size: 13.5px; color: var(--text); opacity: .85; margin-top: 10px; line-height: 1.55; font-style: italic; }
.pick-actions { display: flex; gap: 8px; margin-top: 14px; }
.mini-btn { flex: 1; padding: 11px 6px; border-radius: 13px; font-size: 12px; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer; border: 1px solid var(--glass-border); background: var(--glass); color: var(--text); }
.mini-btn.accent { background: var(--accent-soft); border-color: rgba(232,89,12,.4); color: var(--accent-text); }
.heart { width: 42px; flex-shrink: 0; font-size: 17px; display: flex; align-items: center; justify-content: center; }
.heart.saved { color: var(--accent); border-color: var(--accent); }

/* ---------- collapsible filters ---------- */
.filters-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 16px; cursor: pointer; user-select: none; }
#filtersSummary { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 10px; }
.chev { color: var(--faint); font-size: 15px; transition: transform .3s ease; flex-shrink: 0; }
.filters-head.open .chev { transform: rotate(180deg); }
.filters-body { max-height: 0; overflow: hidden; opacity: 0; transition: max-height .38s ease, opacity .28s ease; }
.filters-body.open { max-height: 660px; opacity: 1; }

/* ---------- roulette ---------- */
.roulette-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(10, 9, 8, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); opacity: 0; transition: opacity .3s ease; }
.roulette-overlay.show { opacity: 1; }
.roulette-card { position: relative; width: 100%; max-width: 430px; max-height: 88dvh; overflow-y: auto; padding: 30px 24px 24px; text-align: center; animation: rise .45s cubic-bezier(.2,.9,.25,1.15) both; }
.roulette-x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 12px; border: 1px solid var(--glass-border); background: var(--glass); color: var(--muted); font-size: 14px; cursor: pointer; }
.roulette-kicker { font-size: 11px; font-weight: 700; letter-spacing: 2px; color: var(--faint); margin-bottom: 14px; }
.roulette-name { font-family: var(--font-d); font-weight: 800; font-size: 29px; letter-spacing: -.6px; line-height: 1.2; min-height: 74px; display: flex; align-items: center; justify-content: center; }
.roulette-name.lock { color: var(--accent-text); animation: pop .5s cubic-bezier(.2,.9,.3,1.4) both; }
.roulette-meta { font-size: 13px; color: var(--muted); margin-top: 8px; min-height: 20px; }
.roulette-win-badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 1.6px; padding: 7px 14px; border-radius: 999px; background: var(--accent); color: #fff; margin-bottom: 12px; animation: pop .5s cubic-bezier(.2,.9,.3,1.4) both; }
/* Winner celebration: orange glow pulses twice, then settles. */
#rouletteWinner { animation: glowPulse 1.2s ease-out both; }
@keyframes glowPulse { 0% { filter: drop-shadow(0 0 0 rgba(232,89,12,0)); } 30% { filter: drop-shadow(0 0 22px rgba(232,89,12,.55)); } 60% { filter: drop-shadow(0 0 8px rgba(232,89,12,.25)); } 100% { filter: drop-shadow(0 0 0 rgba(232,89,12,0)); } }
.roulette-spinner { width: 54px; height: 54px; margin: 8px auto 18px; border-radius: 50%; border: 4px solid rgba(232,89,12,.18); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ---------- vote ---------- */
.countdown { font-family: var(--font-d); font-weight: 800; font-size: 26px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.live-dot { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--ok); }
.live-dot i { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 10px #4ade80; animation: blink 1.6s ease-in-out infinite; font-style: normal; }
.vote-opt { border-radius: 20px; padding: 16px; margin-bottom: 12px; animation: rise .55s cubic-bezier(.2,.9,.25,1.15) both; }
.vote-bar { height: 10px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: 12px; }
.vote-fill { height: 100%; border-radius: 999px; background: var(--accent); width: 0; transition: width 1s cubic-bezier(.2,.8,.3,1); }
.vote-names { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.voter { font-size: 11.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: rgba(255,255,255,.09); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #141311; margin-right: -9px; border: 2px solid var(--bg2); }
.winner-banner { text-align: center; padding: 26px 18px; border-radius: 24px; margin-bottom: 16px; background: var(--accent-soft); border: 1px solid rgba(232,89,12,.45); animation: rise .6s cubic-bezier(.2,.9,.25,1.2) both; }
.winner-banner .t { font-size: 12px; letter-spacing: 1.6px; font-weight: 700; color: var(--accent-text); text-transform: uppercase; }
.winner-banner .n { font-family: var(--font-d); font-weight: 800; font-size: 30px; letter-spacing: -.8px; margin-top: 8px; }

/* ---------- nav ---------- */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: center; padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); background: rgba(20,19,17,.78); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); border-top: 1px solid var(--glass-border); }
.tabbar-inner { display: flex; width: 100%; max-width: 520px; }
.tab { flex: 1; text-align: center; font-size: 10.5px; font-weight: 600; color: var(--faint); text-decoration: none; padding: 6px 0; letter-spacing: .2px; }
.tab.on { color: var(--accent-text); }
.tab svg { display: block; margin: 0 auto 4px; }

/* ---------- states ---------- */
.error-box { border-radius: var(--radius); padding: 16px; background: rgba(255,90,90,.1); border: 1px solid rgba(255,90,90,.35); color: #ffb4b4; font-size: 13.5px; line-height: 1.55; margin-top: 14px; }
.skel { border-radius: 22px; overflow: hidden; margin-bottom: 16px; }
.skel .ph { height: 108px; background: linear-gradient(100deg, var(--bg2) 40%, #262420 50%, var(--bg2) 60%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.skel .ln { height: 14px; border-radius: 7px; margin: 14px 16px 0; background: linear-gradient(100deg, var(--bg2) 40%, #262420 50%, var(--bg2) 60%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.skel .ln.short { width: 55%; margin-bottom: 16px; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 12px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 20px 0 4px; }
.back { border: none; background: var(--glass); border: 1px solid var(--glass-border); color: var(--text); width: 40px; height: 40px; border-radius: 14px; font-size: 17px; cursor: pointer; }
.timer-picks { display: flex; gap: 8px; }
.timer-picks .chip { flex: 1; text-align: center; }

/* ---------- accessibility ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@keyframes rise { from { opacity: 0; transform: translateY(20px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.rise { animation: rise .55s cubic-bezier(.2,.9,.25,1.15) both; }
.d1 { animation-delay: .06s; } .d2 { animation-delay: .12s; } .d3 { animation-delay: .18s; }
