:root {
    color-scheme: dark;
    --bg: #0b0b10;
    --panel: #16161d;
    --panel-soft: #22222b;
    --ink: #f6eedf;
    --muted: #bcb8c2;
    --green: #22c96d;
    --forest:#321620;
    --red:#b81732;
    --yellow:#efcf88;
    --gold: #d5aa52;
    --line:#49404a;
    --chance-backdrop: url('/branding/el-chance-costa-rica-v2.png');
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { width: 100%; max-width: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    width: 100%;
    max-width: 100%;
    min-width: 280px;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--ink);
    isolation: isolate;
    background: var(--bg);
}
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity:.16; background-image:linear-gradient(#0b0b10bb,#0b0b10),var(--chance-backdrop); background-position: center; background-size: cover; background-repeat: no-repeat; }
@media (max-width: 768px) {
    :root { --chance-backdrop: url('/branding/el-chance-costa-rica-movil-v2.png'); }
}

.page-shell { width: min(calc(100% - 32px), 1040px); margin: 28px auto; }
.results-sheet {
    overflow: hidden;
    border: 1px solid var(--line);
    border-top: 3px solid var(--gold);
    border-radius: 20px;
    background: rgba(20, 21, 23,.97);
    box-shadow: 0 28px 80px rgba(0,0,0,.48);
}

.sheet-header {
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 34px 42px 30px;
    border-bottom: 1px solid var(--line);
    background:linear-gradient(100deg,#16161dfa,#16161dbb),var(--chance-backdrop) center/cover;
}
.brand {
    color: #ffe3a1;
    font-size: clamp(1.7rem, 5vw, 2.5rem);
    font-weight: 950;
    letter-spacing: -.045em;
    text-decoration: none;
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand img {
    width: 42px;
    height: 42px;
    display: block;
    border-radius: 13px;
    object-fit: cover;
    border: 1px solid #d7ad4580;
}
.sheet-header p { margin: 10px 0 0 56px; color: #efca73; font-size: .76rem; font-weight: 850; letter-spacing: .14em; }
.sheet-date { text-align: right; }
.sheet-date strong, .sheet-date span { display: block; }
.sheet-date strong { color: var(--yellow); font-size: 1.22rem; }
.sheet-date span { margin-top: 7px; color: var(--muted); font-size: .67rem; font-weight: 800; letter-spacing: .09em; }

.client-access {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 17px 32px;
    border-bottom: 1px solid var(--line);
    background: var(--forest);
}
.client-access strong, .client-access span { display: block; }
.client-access strong { font-size: .9rem; }
.client-access span { margin-top: 3px; color: #ead1c1; font-size: .72rem; }
.client-access__actions { display: flex; gap: 8px; }
.client-access__actions a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 15px;
    border-radius: 12px;
    font-size: .76rem;
    font-weight: 850;
    text-decoration: none;
}
.client-access__login { color: var(--ink); border: 1px solid rgba(255,255,255,.22); }
.client-access__register { color:var(--ink); background:var(--red); border:1px solid #d55268; }

.date-toolbar {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 12px;
    padding: 18px;
    margin:20px 24px 12px;
    border:1px solid #d6b16f73;
    border-radius:18px;
    background:radial-gradient(ellipse at top left,#b1292120,transparent 60%),linear-gradient(135deg,#22222b,#17181b);
    box-shadow:inset 0 1px #ffe4b21a,0 8px 22px #030b1733;
}
.date-form { min-width:0; }
.date-form label { display:flex; align-items:center; gap:8px; margin-bottom:10px; color:#ffe2a5; font-size:.85rem; font-weight:750; }
.date-form label svg { flex-shrink:0; }
.date-form > div { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; }
.date-form input, .date-form button, .date-step, .today-link { min-height: 44px; border: 1px solid var(--line); font: inherit; }
.date-form input { width:100%; min-width:0; padding:9px 12px; color:#fff3dd; background:#0f0f15; border-color:#a9a39969; border-radius:12px; font-size:16px; }
.date-form button { padding:9px 16px; color:#fff0cb; background:linear-gradient(135deg,#b52b24,#781b17); border-color:#f0c57b80; border-radius:12px; font-weight:850; cursor:pointer; white-space:normal; overflow-wrap:anywhere; }
.date-step { width: 44px; display: grid; place-items: center; color: var(--ink); background: var(--panel-soft); border-radius: 12px; font-size: 1.65rem; line-height: 1; text-decoration: none; }
.date-step--disabled { color: #e35954; background: #2a0807; }
.today-link { display: grid; place-items: center; padding: 8px 14px; color: #efca73; border-radius: 12px; font-size: .8rem; font-weight: 850; text-decoration: none; }

.sheet-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 8px;
    margin: 12px 32px 20px;
}
.sheet-summary div { min-width: 0; padding: 13px 10px; text-align: center; border: 1px solid var(--line); border-radius: 15px; background: var(--panel-soft); }
.sheet-summary strong, .sheet-summary span { display: block; }
.sheet-summary strong { color: var(--ink); font-size: 1.15rem; }
.sheet-summary span { margin-top: 3px; color: var(--muted); font-size: .62rem; font-weight: 850; }
.sheet-summary div:nth-child(2) strong { color: var(--green); }
.sheet-summary div:nth-child(3) strong { color: var(--yellow); }
.results-tabs { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin:14px 32px; padding:6px; border:1px solid var(--line); border-radius:16px; background:#230605; }
.results-tabs a { display:flex; align-items:center; justify-content:center; min-height:48px; border:1px solid transparent; border-radius:11px; color:var(--muted); font-weight:850; text-decoration:none; }
.results-tabs a[aria-current=page] { color:#fff1ce; border-color:#d5aa52; background:linear-gradient(145deg,#b5231e,#741512); box-shadow:inset 0 -3px #d5aa52; }
.results-pending-note { margin:0 32px 24px; color:var(--muted); font-size:.76rem; text-align:center; }

.status-message { margin: 0 32px 18px; padding: 12px 14px; color: #ffe8a4; background: rgba(255,212,71,.08); border: 1px solid rgba(255,212,71,.2); border-radius: 14px; font-size: .84rem; }
.results-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; padding: 0 32px 32px; }
.result-row {
    min-width: 0;
    min-height: 72px;
    display: grid;
    grid-template-columns: 42px minmax(0,1fr) auto;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    border-radius: 16px;
    background: var(--panel-soft);
}
.result-row--pending { border-left-color: var(--yellow); }
.flag { position: relative; width: 32px; height: 24px; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; background: #fff; font-size: 0; line-height: 1; }
.flag-cr { background: linear-gradient(to bottom,#002b7f 0 17%,#fff 17% 33%,#ce1711 33% 67%,#fff 67% 83%,#002b7f 83%); }
.flag-ni,.flag-hn,.flag-sv { background: linear-gradient(to bottom,#1672c4 0 34%,#fff 34% 66%,#1672c4 66%); }
.flag-gt { background: linear-gradient(to right,#4997d0 0 34%,#fff 34% 66%,#4997d0 66%); }
.flag-do { background: linear-gradient(to right,transparent 43%,#fff 43% 57%,transparent 57%),linear-gradient(to bottom,transparent 43%,#fff 43% 57%,transparent 57%),conic-gradient(#ce1711 0 25%,#002d62 0 50%,#ce1711 0 75%,#002d62 0); }
.flag-us,.flag-pr { background: repeating-linear-gradient(to bottom,#b6231e 0 2px,#fff 2px 4px); }
.flag-us::before { content: ""; position: absolute; inset: 0 50% 45% 0; background: #002b7f; }
.flag-pr::before { content: ""; position: absolute; inset: 0 45% 0 0; background: #002b7f; clip-path: polygon(0 0,100% 50%,0 100%); }
.flag-pa { background: conic-gradient(#d21610 0 25%,#fff 0 50%,#005293 0 75%,#fff 0); }
.flag-co { background: linear-gradient(to bottom,#fcd116 0 50%,#003893 50% 75%,#ce1711 75%); }
.flag-sx { background: linear-gradient(to right,#002395 0 33%,#fff 33% 66%,#ed3029 66%); }
.flag-ap { background: url('/branding/el-chance-icon.jpg') center / cover; }
.result-name { min-width: 0; }
.result-name h2 { margin: 0; color: var(--ink); font-size: .9rem; line-height: 1.4; overflow-wrap: anywhere; }
.result-name p { margin: 5px 0 0; color: var(--muted); font-size: .78rem; }
.result-value { min-width: 54px; text-align: right; }
.result-value > strong { display: block; color: var(--gold); font-size: 1.65rem; line-height: 1; letter-spacing: -.04em; }
.ball { display: block; margin-top: 7px; color: var(--muted); font-size: .65rem; font-weight: 750; }
.ball--r { color: #ff7770; }
.pending-result { color: var(--yellow); font-size: .7rem; letter-spacing: .04em; }
.results-refresh { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:16px 32px; }
.results-refresh[hidden] { display:none; }
.results-refresh p, .results-consulted { color:var(--muted); font-size:.8rem; line-height:1.5; }
.results-refresh p { margin:0; }
.results-refresh [data-error] { color:#ffe0a3; }
.results-refresh button { flex-shrink:0; min-height:44px; min-width:170px; padding:10px 14px; border:1px solid var(--gold); border-radius:12px; background:#451c20; color:var(--ink); font:inherit; font-size:.85rem; font-weight:750; cursor:pointer; }
.results-refresh button:disabled { opacity:.7; cursor:wait; }
.results-consulted { margin:16px 32px 24px; }
#public-results .pulso-panel { margin:16px 32px; }
:where(a,button,input,summary):focus-visible { outline:3px solid #ffe0a3; outline-offset:3px; }

.empty-state { margin: 0 32px 32px; padding: 46px 24px; text-align: center; border: 1px solid var(--line); border-radius: 18px; background: var(--panel-soft); }
.empty-state p { margin: 8px 0 0; color: var(--muted); }
.sheet-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 32px; padding: 18px 0 24px; color: var(--muted); border-top: 1px solid var(--line); font-size: .7rem; }
.sheet-footer div { display: grid; gap: 4px; }
.sheet-footer strong { color: var(--ink); }
.whatsapp-link { padding: 11px 15px; color: #fff1da; background: linear-gradient(170deg,#b1221d,#711512); border: 1px solid #d7ad4580; border-radius: 999px; font-size: .74rem; font-weight: 850; text-decoration: none; }
.disclaimer { margin: 15px 0 0; color: #d1bdb2; font-size: .7rem; text-align: center; }
.disclaimer a { color:#ffe3ae; text-decoration:underline; text-underline-offset:3px; }

.date-step:focus-visible, .today-link:focus-visible, .date-form input:focus-visible, .date-form button:focus-visible, .client-access__actions a:focus-visible, .whatsapp-link:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

@media (max-width: 700px) {
    .page-shell { width: 100%; margin: 0; padding-bottom: 20px; }
    .results-sheet { border-width: 0 0 1px; border-radius: 0 0 24px 24px; }
    .sheet-header { min-height: 120px; padding: 22px 16px 20px; }
    .brand { font-size: 1.5rem; }
    .brand { gap: 8px; }
    .brand img { width: 36px; height: 36px; border-radius: 11px; }
    .sheet-header p { margin-left: 45px; font-size: .64rem; }
    .sheet-date strong { font-size: .92rem; }
    .sheet-date span { max-width: 90px; font-size: .53rem; }
    .client-access { align-items: stretch; flex-direction: column; gap: 11px; padding: 14px; }
    .client-access__actions { display: grid; grid-template-columns: 1fr 1fr; }
    .date-toolbar { flex-wrap: wrap; padding:14px; margin-inline:14px; }
    .date-form { order: -1; width: 100%; }
    .date-form > div { width: 100%; }
    .date-form input { flex: 1; width: auto; font-size: 16px; }
    .date-step { flex: 1; }
    .today-link { flex: 2; }
    .sheet-summary { margin: 8px 14px 14px; gap: 6px; }
    .results-tabs { margin:12px 14px; }
    .results-pending-note { margin-inline:14px; }
    .results-refresh { margin-inline:14px; flex-wrap:wrap; }
    .results-refresh button { width:100%; }
    .results-consulted, #public-results .pulso-panel { margin-inline:14px; }
    .sheet-summary div { padding: 10px 4px; }
    .sheet-summary strong { font-size: 1.05rem; }
    .sheet-summary span { font-size: .65rem; line-height:1.4; }
    .status-message { margin: 0 14px 12px; }
    .results-list { grid-template-columns: 1fr; gap: 8px; padding: 0 14px 20px; }
    .result-row { min-height: 66px; }
    .result-name h2 { font-size: .8rem; }
    .result-value > strong { font-size: 1.62rem; }
    .empty-state { margin: 0 14px 20px; }
    .sheet-footer { align-items: stretch; flex-direction: column; margin: 0 14px; }
    .whatsapp-link { text-align: center; }
    .disclaimer { padding: 0 14px; }
}

.plus-ad { display:grid; grid-template-columns:minmax(0,1fr) 180px; gap:20px; margin:16px 20px; padding:22px; border:1px solid #cb9b3e; border-radius:20px; background:linear-gradient(120deg,#2d0907,#651310); color:#fae4b1; }
.plus-ad h2 { font-size:1.5rem; margin:10px 0; color:#ffe3a1; }
.plus-ad small { display:block; margin:12px 0; color:#f1ddcf; }
.plus-ad-label { font-size:.75rem; letter-spacing:.12em; }
.plus-ad-art { display:grid; align-content:center; text-align:center; color:#f6d387; }
.plus-ad-art svg { width:100%; }
.plus-ad .client-access__actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:18px; }
@media (max-width:600px) { .plus-ad { grid-template-columns:1fr; margin:12px; padding:18px; } .plus-ad-art { display:none; } }
@media print {
    .plus-ad { display:none; }
    :root { color-scheme: light; --ink: #0d1830; --muted: #596373; --line: #d3d9df; --panel: #fff; --panel-soft: #f5f7f8; }
    body { color: var(--ink); background: #fff; }
    body::before { display: none; }
    .page-shell { width: 100%; margin: 0; }
    .results-sheet { border: 0; border-radius: 0; box-shadow: none; background: #fff; }
    .sheet-header { color: #fff; background: #111512; }
    .client-access, .date-toolbar, .disclaimer, .results-refresh { display: none; }
}
