/* WhenWins — shared styles */
:root {
  --brand: #ff5722;          /* logo mark, highlights */
  --primary: #cf400f;        /* buttons: passes contrast with white text */
  --primary-hover: #b3370c;
  --primary-soft: #fff1ea;
  --ink: #0f172a;
  --muted: #475569;
  --faint: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --good: #15803d;
  --good-soft: #ecfdf3;
  --good-line: #bbf7d0;
  --bad: #b91c1c;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; background: #fff; padding: 8px 12px; z-index: 50; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(248, 250, 252, .9); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.site-header .inner { max-width: 960px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none; letter-spacing: -0.03em; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.logo-mark svg { width: 17px; height: 17px; }
.nav-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-family: inherit; font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; cursor: pointer; }
.nav-link:hover { border-color: #cbd5e1; }

main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; }
.narrow { max-width: 560px; margin: 0 auto; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 20px; }
@media (min-width: 600px) { .card { padding: 32px; } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--primary); }
.lead { color: var(--muted); font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Buttons */
.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: 700; font-size: 16px; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -8px rgba(207, 64, 15, .6); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-whatsapp { background: var(--good); color: #fff; }
.btn-whatsapp:hover { background: #116932; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-danger { background: #fff; color: var(--bad); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 17px; }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 15px; }
.link-btn { background: none; border: 0; padding: 8px 4px; min-height: 44px; font: inherit; font-weight: 600; color: var(--primary); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid rgba(207, 64, 15, .45); outline-offset: 2px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .label { font-weight: 700; font-size: 15px; }
.hint { font-weight: 400; color: var(--faint); font-size: 14px; }
.input { width: 100%; min-height: 50px; padding: 12px 14px; border: 1px solid #cbd5e1; border-radius: 12px; font: inherit; font-size: 16px; color: var(--ink); background: #fff; }
.input::placeholder { color: #94a3b8; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(207, 64, 15, .15); }
.error { color: var(--bad); font-size: 14px; font-weight: 600; min-height: 0; }
.notice { background: var(--primary-soft); border: 1px solid #fed7c3; border-radius: 12px; padding: 12px 14px; font-size: 15px; color: #7c2d12; }
.notice-good { background: var(--good-soft); border-color: var(--good-line); color: #14532d; }

/* Calendar */
.cal { border: 1px solid var(--line); border-radius: 14px; padding: 8px; background: #fff; }
@media (min-width: 600px) { .cal { padding: 14px; } }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-title { font-weight: 700; font-size: 17px; }
.cal-nav { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.cal-nav:disabled { opacity: .35; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; text-align: center; }
.cal-dow { font-size: 12px; font-weight: 700; color: var(--faint); padding: 6px 0; text-transform: uppercase; letter-spacing: .04em; }
.cal-day { height: 44px; min-width: 0; padding: 0; border-radius: 10px; border: 0; background: transparent; font: inherit; font-weight: 600; font-size: 16px; color: var(--ink); cursor: pointer; position: relative; }
@media (hover: hover) { .cal-day:hover:not(:disabled):not([aria-pressed="true"]) { background: #f1f5f9; } }
.cal-day { -webkit-tap-highlight-color: transparent; }
.cal-day.weekend { color: #334155; }
.cal-day.today::after { content: ''; position: absolute; left: 50%; bottom: 6px; width: 4px; height: 4px; border-radius: 50%; background: var(--primary); transform: translateX(-50%); }
.cal-day[aria-pressed="true"], .cal-day[aria-pressed="true"]:hover, .cal-day[aria-pressed="true"]:focus { background: var(--primary); color: #fff; }
.cal-day[aria-pressed="true"].today::after { background: #fff; }
.cal-day:disabled { color: #cbd5e1; cursor: default; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding-left: 12px; border-radius: 999px; background: var(--primary-soft); color: #7c2d12; font-weight: 600; font-size: 14px; border: 1px solid #fed7c3; }
.chip button { width: 36px; height: 36px; border: 0; background: none; color: inherit; cursor: pointer; display: grid; place-items: center; border-radius: 999px; }
.chip button svg { width: 16px; height: 16px; }

/* Sticky action bar on phones */
.action-bar { position: sticky; bottom: 0; z-index: 5; margin: 0 -20px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(255,255,255,0), #fff 30%); }
@media (min-width: 600px) { .action-bar { margin: 0; padding: 0; background: none; position: static; } }

/* Vote options */
.options { display: flex; flex-direction: column; gap: 8px; }
.option { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 60px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; background: #fff; transition: border-color .15s, background .15s; }
.option:hover { border-color: #cbd5e1; }
.option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.option .box { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2px solid #94a3b8; display: grid; place-items: center; color: transparent; background: #fff; }
.option .box svg { width: 16px; height: 16px; }
.option .when { display: flex; flex-direction: column; }
.option .dow { font-weight: 700; }
.option .dm { color: var(--muted); font-size: 15px; }
.option:has(input:checked) { border-color: var(--good); background: var(--good-soft); }
.option:has(input:checked) .box { background: var(--good); border-color: var(--good); color: #fff; }
.option:has(input:focus-visible) { outline: 3px solid rgba(207, 64, 15, .45); outline-offset: 2px; }
.option.checked { border-color: var(--good); background: var(--good-soft); }
.option.checked .box { background: var(--good); border-color: var(--good); color: #fff; }

.meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 15px; }
.meta span { display: inline-flex; align-items: center; gap: 6px; }
.meta svg { width: 18px; height: 18px; }

/* Gift / affiliate */
.gift { display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center; padding: 16px; border-radius: 14px; background: linear-gradient(135deg, #fff7f2, #fff); border: 1px solid #fed7c3; }
.gift-icon { width: 44px; height: 44px; border-radius: 12px; background: #fff; border: 1px solid #fed7c3; display: grid; place-items: center; color: var(--primary); }
.gift-copy { display: flex; flex-direction: column; gap: 2px; font-size: 15px; color: var(--muted); }
.gift-copy strong { color: var(--ink); font-size: 16px; }
.btn-gift { grid-column: 1 / -1; background: #fff; color: #9a3412; border: 1px solid #fdba8c; min-height: 46px; font-size: 15px; }
.btn-gift:hover { background: #fff7f2; }
@media (min-width: 600px) { .gift { grid-template-columns: auto 1fr auto; } .btn-gift { grid-column: auto; } }

/* Results */
.result { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.result.best { border-color: var(--good-line); background: var(--good-soft); }
.result-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.result-date { font-weight: 700; font-size: 17px; }
.result-count { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 8px; border-radius: 999px; background: #eef2f6; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: #94a3b8; }
.result.best .bar i { background: var(--good); }
.names { display: flex; flex-wrap: wrap; gap: 6px; }
.name { font-size: 14px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #eef2f6; color: #1e293b; }
.name.yes { background: #dcfce7; color: #14532d; }
.name.no { background: transparent; color: var(--faint); border: 1px dashed #cbd5e1; text-decoration: line-through; text-decoration-color: #cbd5e1; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 3px 9px; border-radius: 999px; background: var(--good); color: #fff; vertical-align: middle; }
.badge svg { width: 13px; height: 13px; }

.hero-best { border-radius: 14px; padding: 18px; background: var(--ink); color: #fff; display: flex; flex-direction: column; gap: 6px; }
.hero-best .k { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #fdba8c; }
.hero-best .v { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.hero-best .s { color: #cbd5e1; font-size: 15px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); text-align: center; color: var(--faint); font-size: 13px; }
.site-footer p { max-width: 560px; margin: 0 auto; }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #e2e8f0; border-top-color: var(--primary); animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 1.5s !important; } }

/* ---------- v3: event types, quick picks, yes / maybe / no, lock-in ---------- */
.types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 520px) { .types { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.type { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font: inherit; font-weight: 600; font-size: 15px; color: var(--ink); cursor: pointer; text-align: left; transition: border-color .15s, background .15s, transform .1s; }
.type:hover { border-color: #cbd5e1; }
.type:active { transform: scale(.98); }
.type .ti { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--t-soft); color: var(--t-color); }
.type .ti svg { width: 19px; height: 19px; }
.type[aria-pressed="true"] { border-color: var(--t-color); background: var(--t-soft); box-shadow: 0 0 0 1px var(--t-color) inset; }

.quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 2px; }
.quick::-webkit-scrollbar { display: none; }
.quick button { flex: none; white-space: nowrap; }
.quick button { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.quick button:hover { border-color: #cbd5e1; color: var(--ink); }

.type-badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border-radius: 999px; background: var(--t-soft, var(--primary-soft)); color: var(--t-color, var(--primary)); font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.type-badge svg { width: 16px; height: 16px; }
.hero-band { height: 6px; border-radius: 999px; background: var(--t-color, var(--primary)); opacity: .9; }

/* Yes / Maybe / No */
.answer { display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 12px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; transition: border-color .15s, background .15s; }
.answer[data-s="yes"] { border-color: var(--good); background: var(--good-soft); }
.answer[data-s="maybe"] { border-color: #d97706; background: #fffbeb; }
.answer[data-s="no"] { background: #f8fafc; }
.answer .when { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.answer .dow { font-weight: 700; font-size: 17px; }
.answer .dm { color: var(--muted); }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.seg button { min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: inherit; font-weight: 700; font-size: 15px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, color .15s, border-color .15s, transform .1s; }
.seg button svg { width: 17px; height: 17px; }
.seg button:active { transform: scale(.97); }
.seg button[aria-pressed="true"][data-v="yes"] { background: var(--good); border-color: var(--good); color: #fff; }
.seg button[aria-pressed="true"][data-v="maybe"] { background: #b45309; border-color: #b45309; color: #fff; }
.seg button[aria-pressed="true"][data-v="no"] { background: #475569; border-color: #475569; color: #fff; }
.tally { display: flex; gap: 14px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tally b { color: var(--ink); }

.name.maybe { background: #fef3c7; color: #78350f; }
.bar { display: flex; }
.bar i { border-radius: 0; }
.bar i.m { background: #f59e0b; }
.result.best .bar i.m { background: #f59e0b; }
.bar i { transition: width .6s cubic-bezier(.2, .8, .2, 1); }

/* Locked-in date */
.final { border-radius: 18px; padding: 22px 20px; background: var(--ink); color: #fff; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.final .k { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #fdba8c; display: inline-flex; align-items: center; gap: 6px; }
.final .k svg { width: 16px; height: 16px; }
.final .v { font-size: clamp(26px, 7vw, 34px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.final .s { color: #cbd5e1; font-size: 15px; }
.final .names .name { background: rgba(255,255,255,.12); color: #fff; }
.final .names .name.maybe { background: rgba(245,158,11,.25); color: #fde68a; }
.cal-actions { display: grid; gap: 8px; }
@media (min-width: 520px) { .cal-actions { grid-template-columns: 1fr 1fr; } }
.lock-btn { align-self: flex-start; }
.result-actions { display: flex; justify-content: flex-end; }
.btn-lock { min-height: 40px; padding: 0 12px; font-size: 14px; border-radius: 10px; background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-lock:hover { border-color: #cbd5e1; }
.result.locked { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }

/* ---------- v7: place link & photo ---------- */
.place-extra { display: flex; flex-direction: column; gap: 10px; }
.photo-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.photo-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.photo-thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); }
.place-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.place-card img { width: 100%; max-height: 220px; object-fit: cover; display: block; }
.place-card .pc-body { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; }
.place-card .pc-name { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.place-card .pc-name svg { width: 18px; height: 18px; color: var(--primary); flex: none; }
.place-card .pc-links { display: flex; flex-wrap: wrap; gap: 8px; }
.place-card .pc-links a { flex: 1 1 auto; }
