/* Sunday Best – mobile-first styles (matches the 390px prototype). */
:root {
  --purple: #5B2A86; --purple-dark: #3E1A5E; --purple-soft: #F3ECFA; --purple-line: #D9C7EC;
  --gold: #F2B53A; --gold-soft: #FFF3D6; --ink: #1C1A2E; --muted: #6B6680; --line: #ECE8F1;
  --field: #D9D3E3; --bg-soft: #F7F5FA; --green: #1B7A43; --green-soft: #E3F5EA; --red: #B3261E;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: #EDEAF2; color: var(--ink); font: 15px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Myanmar", "Noto Sans Sinhala", "Noto Sans Tamil", "Noto Sans Devanagari", sans-serif; }
a { color: var(--purple); } a:hover { color: var(--purple-dark); }
h1 { font-size: 28px; line-height: 1.15; margin: 8px 0; font-weight: 800; }
h2 { font-size: 20px; margin: 0 0 12px; font-weight: 800; }
.h3 { font-size: 17px; font-weight: 800; margin: 20px 0 8px; display: block; }
input, select, button { font: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.app { max-width: 480px; min-height: 100vh; margin: 0 auto; background: #fff; position: relative; }
main { padding-bottom: 24px; }

/* Header */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; align-items: center; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand-logo { width: 32px; height: 32px; border-radius: 10px; background: var(--purple); display: grid; place-items: center; }
.brand strong { display: block; font-size: 15px; line-height: 1.1; } .brand small { display: block; font-size: 11px; color: var(--muted); }
.lang select { height: 36px; border: 1px solid var(--field); border-radius: 10px; padding: 0 8px; background: #fff; max-width: 130px; }
.icon-btn { width: 36px; height: 36px; border: 1px solid var(--field); border-radius: 10px; display: grid; place-items: center; color: var(--purple); }

/* Hero */
.hero { background: var(--purple); color: #fff; padding: 20px 16px 22px; }
.hero h1 { font-size: 30px; } .hero p { color: #E6DAF2; margin: 8px 0 16px; }
.pill { display: inline-block; background: var(--gold); color: var(--ink); font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { background: rgba(255,255,255,.12); border-radius: var(--radius); padding: 10px 12px; }
.stat strong { display: block; font-size: 20px; } .stat small { color: #E6DAF2; font-size: 12px; }
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.muted-light { color: #E6DAF2; }

/* Buttons */
.btn { display: flex; align-items: center; justify-content: center; width: 100%; height: 44px; border-radius: var(--radius); border: none; font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer; margin-top: 10px; }
.btn-lg { height: 52px; font-size: 16px; }
.btn-sm { height: 34px; width: auto; padding: 0 14px; margin: 0; }
.btn-primary { background: var(--purple); color: #fff; } .btn-primary:hover { background: var(--purple-dark); color: #fff; }
.btn-accent { background: var(--gold); color: var(--ink); margin: 0; }
.btn-outline-light { background: transparent; color: #fff; border: 2px solid #fff; margin: 0; } .btn-outline-light:hover { color: #fff; }
.btn-voted { background: var(--purple-soft); color: var(--purple); border: 1px solid var(--purple-line); cursor: default; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--field); }
.btn-whatsapp { background: var(--green); color: #fff; } .btn-whatsapp:hover { color: #fff; }
.link-btn { background: none; border: none; color: var(--purple); text-decoration: underline; cursor: pointer; padding: 8px 0; }
.link-btn.danger { color: var(--red); margin-top: 16px; }

/* Sections */
.section { padding: 20px 16px 4px; }
.page { padding: 16px; }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: 12px; margin-bottom: 12px; } .steps p { margin: 0; color: var(--muted); }
.step-icon { flex: 0 0 32px; height: 32px; border-radius: 10px; background: var(--purple-soft); display: grid; place-items: center; color: var(--purple); }
.prizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.prize { background: var(--purple-soft); border-radius: var(--radius); padding: 10px 6px; text-align: center; }
.prize small { display: block; color: var(--purple); font-weight: 700; font-size: 12px; } .prize strong { font-size: 18px; }
.prize-gold { background: var(--gold-soft); } .prize-gold small { color: #8A5A00; }
.note { border: 1px dashed var(--field); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }

/* Contestants */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; }
.chip { flex-shrink: 0; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--field); display: flex; align-items: center; font-weight: 700; font-size: 14px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.card-photo { position: relative; display: block; aspect-ratio: 4 / 5; background: #8E6BB0; }
.card-photo img, .big-photo img, .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rank { position: absolute; top: 8px; left: 8px; background: #fff; border-radius: 999px; font-size: 12px; font-weight: 700; padding: 1px 8px; }
.photo-locked { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 13px; text-align: center; padding: 8px; text-decoration: none; }
.card-body { padding: 10px; } .card-body .btn { margin-top: 8px; }
.card-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.card-meta small { display: block; color: var(--muted); font-size: 12px; }
.votes { color: var(--purple); font-weight: 700; font-size: 14px; white-space: nowrap; }

/* Detail */
.back { display: inline-block; background: var(--purple-soft); color: var(--purple); font-weight: 700; padding: 8px 14px; border-radius: 10px; text-decoration: none; margin-bottom: 12px; }
.big-photo { position: relative; height: 440px; border-radius: 20px; overflow: hidden; background: #8E6BB0; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-end; margin: 12px 0 4px; }
.detail-head h1 { margin: 0; }
.big-votes { text-align: right; } .big-votes strong { display: block; font-size: 28px; color: var(--purple); line-height: 1; } .big-votes small { color: var(--muted); }
.share { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; } .share .btn { margin: 0; }

/* Forms */
.form label { display: block; font-weight: 700; font-size: 14px; margin: 14px 0 6px; }
.form input:not([type=checkbox]):not([type=file]), .form select { width: 100%; height: 48px; border: 1px solid var(--field); border-radius: var(--radius); padding: 0 14px; background: #fff; font-size: 16px; }
.form input:focus, .form select:focus { outline: 2px solid var(--purple); outline-offset: 1px; }
.phone { display: flex; gap: 8px; } .phone span { flex: 0 0 56px; display: grid; place-items: center; border: 1px solid var(--field); border-radius: var(--radius); background: var(--bg-soft); }
.consents { border: none; background: var(--bg-soft); border-radius: 14px; padding: 6px 14px; margin: 16px 0 6px; }
.consents label { display: flex; gap: 10px; font-weight: 400; margin: 10px 0; align-items: flex-start; }
.consents input { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 2px; accent-color: var(--purple); }
.upload { display: flex !important; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-height: 150px; justify-content: center; border: 2px dashed #C9BEDA; border-radius: 16px; background: var(--bg-soft); color: var(--purple); cursor: pointer; padding: 16px; }
.upload.has-file { background: var(--green-soft); border: 2px solid var(--green); color: var(--green); }
.upload small { font-weight: 400; } .upload input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.upload-icon { font-size: 26px; }
.otp-input { text-align: center; letter-spacing: 12px; font-size: 24px !important; height: 60px !important; }
.readonly { background: var(--bg-soft); border-radius: var(--radius); padding: 10px 14px; margin: 14px 0 0; }
.alert { background: #FDECEA; color: var(--red); border-radius: var(--radius); padding: 10px 14px; }
.dev { background: #FFF3D6; border-radius: 8px; padding: 6px 10px; font-family: monospace; }
.icon-badge { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 28px; margin: 8px 0; }
.page.center .icon-badge { margin: 8px auto; border-radius: 50%; width: 80px; height: 80px; }
.icon-green { background: var(--green-soft); } .icon-gold { background: var(--gold-soft); color: #8A5A00; }
.stack { display: grid; gap: 4px; margin-top: 16px; }

/* My entry */
.my-entry { display: flex; gap: 16px; align-items: center; margin: 12px 0; }
.thumb { width: 110px; height: 138px; border-radius: 14px; overflow: hidden; background: #8E6BB0; flex-shrink: 0; }
.my-entry p { margin: 2px 0; }
.badge { display: inline-block; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--purple-soft); color: var(--purple); }
.badge-approved { background: var(--green-soft); color: var(--green); } .badge-rejected { background: #FDECEA; color: var(--red); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* Footer, toast */
.footer { background: var(--bg-soft); padding: 18px 16px 28px; font-size: 13px; color: var(--muted); margin-top: 16px; }
.footer p { margin: 0 0 8px; }
.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: calc(100% - 32px); max-width: 448px; background: var(--ink); color: #fff; border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 10px; align-items: center; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast span { flex: 1; } .toast button { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; }
.prose ul { padding-left: 20px; } .prose li { margin-bottom: 6px; }

/* Staff preview of a draft page */
.draft-banner { background: #FFF3D6; color: #8A5A00; border: 1px dashed #E0A82E; border-radius: 12px; padding: 10px 14px; font-weight: 700; font-size: 14px; }

/* Password field with Show/Hide, links between sign-in and register */
.password { display: flex; gap: 8px; }
.password input { flex: 1; min-width: 0; }
.pw-toggle { flex: 0 0 auto; height: 48px; padding: 0 14px; border: 1px solid var(--field); border-radius: var(--radius); background: var(--bg-soft); color: var(--purple); font-weight: 700; cursor: pointer; }
.field-hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.switch-auth { margin: 4px 0 8px; } .switch-auth a { font-weight: 700; }
.right-link { text-align: right; margin: 8px 0 0; font-size: 14px; }
.row-between + .row-between { margin-top: 10px; }

/* Date of birth: Day / Month / Year dropdowns */
.form fieldset.dob { border: 0; padding: 0; margin: 14px 0 0; min-width: 0; }
.dob legend { font-weight: 700; font-size: 14px; padding: 0; margin-bottom: 6px; }
.dob-row { display: grid; grid-template-columns: 1fr 1.6fr 1.2fr; gap: 8px; }
.form .dob label { margin: 0; font-weight: 400; }
.dob label span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } /* label for screen readers; the first option shows it */
.dob select { width: 100%; }

/* Back link: arrow icon + text on one line */
.back { display: inline-flex; align-items: center; gap: 6px; }
.back .icon-back { flex-shrink: 0; transition: transform .15s; }
.back:hover .icon-back { transform: translateX(-2px); }

/* =====================================================================
   Polish pass (01/12/2026)
   ===================================================================== */
/* Phone-shaped column on large screens; footer always at the bottom */
.app { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }
@media (min-width: 520px) {
  body { background: radial-gradient(1200px 600px at 50% -10%, #E7DDF2, #EDEAF2 60%); }
  .app { box-shadow: 0 0 0 1px rgba(91,42,134,.06), 0 20px 60px rgba(28,26,46,.10); }
}
.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* Header language picker with globe icon */
.lang { position: relative; display: flex; align-items: center; }
.lang .lang-icon { position: absolute; left: 10px; color: var(--purple); pointer-events: none; }
.lang select { appearance: none; -webkit-appearance: none; padding: 0 28px 0 32px; height: 36px; border-radius: 10px; font-size: 14px; color: var(--ink);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6680' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center; }
.icon-btn { color: var(--purple); background: #fff; }

/* How it works */
.step-icon { flex: 0 0 36px; height: 36px; border-radius: 11px; }
.steps li { align-items: flex-start; }
.steps strong { display: block; margin-top: 6px; }

/* Search */
.search { position: relative; display: flex; align-items: center; margin: 0 0 12px; }
.search .search-icon { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 46px; padding: 0 40px 0 42px; border: 1px solid var(--field); border-radius: 999px; font-size: 15px; background: var(--bg-soft); }
.search input:focus { outline: none; border-color: var(--purple); background: #fff; box-shadow: 0 0 0 3px var(--purple-soft); }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { position: absolute; right: 8px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; text-decoration: none; color: var(--muted); font-size: 20px; }
.search-clear:hover { background: var(--line); color: var(--ink); }
.result-count { margin: -4px 0 12px; color: var(--muted); font-size: 14px; }

/* Chips: swipe sideways, no scrollbar */
.chips { scrollbar-width: none; -ms-overflow-style: none; margin: 0 -16px; padding: 0 16px 14px; scroll-padding: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 38px; }

/* Contestant cards */
.card { background: #fff; box-shadow: 0 1px 2px rgba(28,26,46,.04); transition: box-shadow .15s; scroll-margin-top: 80px; }
.card:hover { box-shadow: 0 6px 18px rgba(28,26,46,.08); }
.card-photo img { transition: transform .3s; }
.card-photo:hover img { transform: scale(1.03); }
.card-photo { overflow: hidden; }
.rank { z-index: 1; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.card-name { min-width: 0; } .card-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.votes { display: inline-flex; align-items: center; gap: 4px; }
.card:target { box-shadow: 0 0 0 3px var(--gold); }

/* Empty states */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 16px; color: var(--muted); text-align: center; border: 1px dashed var(--field); border-radius: 16px; }
.empty .icon { color: var(--purple); }
.empty p { margin: 0; max-width: 300px; }
.empty-card { text-align: center; padding: 24px 18px 8px; border: 1px dashed var(--field); border-radius: 16px; margin: 8px 0 4px; }
.empty-card p { color: var(--muted); margin: 8px 0 4px; }
.empty-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--purple-soft); color: var(--purple); display: inline-grid; place-items: center; }

/* Load more */
.load-more { margin-top: 8px; }
.load-more.is-loading a { opacity: .6; pointer-events: none; }
.load-more.is-loading a::after { content: ""; width: 16px; height: 16px; margin-left: 10px; border: 2px solid var(--field); border-top-color: var(--purple); border-radius: 50%; animation: sb-spin .8s linear infinite; }
@keyframes sb-spin { to { transform: rotate(360deg); } }

/* Buttons with icons */
.btn { gap: 8px; }
.share .btn { font-size: 14px; }
.share .ic-wa { color: #25D366; } .share .ic-fb { color: #1877F2; }
.share .btn.is-done { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.btn-whatsapp .icon { color: #fff; }
.big-votes strong { display: inline-flex; align-items: center; gap: 4px; }

/* Icon badges (OTP, done, error) */
.icon-badge { color: var(--purple); }
.icon-green { color: var(--green); } .icon-gold { color: #8A5A00; } .icon-soft { background: var(--purple-soft); color: var(--purple); }

/* My entry: settings list */
.settings { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.setting { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--purple-soft); color: var(--purple); display: grid; place-items: center; flex-shrink: 0; }
.setting-text { flex: 1; min-width: 0; font-size: 15px; }
.setting .btn-sm { flex-shrink: 0; }
.danger-zone { margin-top: 18px; text-align: center; }
.link-btn.danger { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-size: 14px; }
.link-btn.danger:hover span { text-decoration: underline; }

/* Error page */
.error-page { padding-top: 48px; padding-bottom: 32px; }
.error-code { margin: 14px 0 0; font-size: 13px; font-weight: 800; letter-spacing: 3px; color: var(--purple); }
.error-page h1 { font-size: 24px; margin: 4px 0 18px; }

/* Footer */
.footer { margin-top: 24px; }
.footer-free { color: var(--ink); font-weight: 600; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; }
.footer-links a { color: var(--purple); font-weight: 600; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* Toast with check icon */
.toast .toast-icon { color: #8EE0A9; }
.toast { animation: sb-toast .25s ease-out; }
@keyframes sb-toast { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* Keyboard focus visible everywhere */
a:focus-visible, button:focus-visible, select:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
#contestants { scroll-margin-top: 64px; }
/* Soft shimmer while a lazy photo is still loading */
.js .card-photo { background: linear-gradient(110deg, #E9E3F1 30%, #F4F0F9 50%, #E9E3F1 70%) 0 0 / 200% 100%; animation: sb-shimmer 1.4s linear infinite; }
.js .card-photo:has(img[data-loaded]) { animation: none; }
@keyframes sb-shimmer { to { background-position: -200% 0; } }
/* Only with JavaScript on: without it the photos are simply shown */
.js .card-photo img { opacity: 0; transition: opacity .3s, transform .3s; }
.js .card-photo img[data-loaded] { opacity: 1; }
.big-votes { display: flex; flex-direction: column; align-items: flex-end; }
.big-votes small { display: block; }

/* Languages with longer words and taller letters: buttons may take two lines */
.btn { height: auto; min-height: 44px; padding: 8px 12px; line-height: 1.3; text-align: center; }
.btn-lg { min-height: 52px; }
.btn-sm { min-height: 34px; padding: 4px 14px; }
.actions .btn, .hero .btn { height: auto; }
.form .dob select { padding: 0 4px 0 8px; }
input::placeholder { text-overflow: ellipsis; }
h1:lang(my), h1:lang(si), h1:lang(ta), h1:lang(hi) { line-height: 1.35; }
:is(h1, .hero h1):is(:lang(my), :lang(si), :lang(ta), :lang(hi)) { font-size: 26px; }
.share .btn { flex-direction: column; gap: 4px; padding: 10px 4px; font-size: 13px; min-height: 64px; }

/* Community filter: all choices visible, on more lines when needed (a hidden scroll row is easy to miss) */
.chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0 0 14px; }

/* Winners page and contest history */
.winner-list { list-style: none; margin: 0 0 8px; padding: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.winner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; } .winner + .winner { border-top: 1px solid var(--line); }
.winner-first { background: var(--gold-soft); }
.winner-photo { width: 56px; height: 70px; border-radius: 10px; overflow: hidden; background: var(--purple-soft); color: var(--purple); display: grid; place-items: center; flex-shrink: 0; }
.winner-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.winner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; } .winner-text small { color: var(--muted); } .winner-text strong { overflow-wrap: anywhere; }
.winner-prize { font-weight: 800; color: var(--purple); white-space: nowrap; }
.history-prize { color: var(--green); font-weight: 700; }
.setting-text small { display: block; font-size: 12px; line-height: 1.4; margin-top: 2px; }
