/* OBA Lotereya: site styles. Mobile first: base rules are for phones, @media (min-width) widens them. */

:root {
    --green: #007332;
    --green-dark: #00592A;
    --green-soft: #E6F2EA;
    --yellow-soft: #FFF6CC;
    --yellow-text: #5C4800;
    --ink: #1A1A1A;
    --ink-2: #2F3236;
    --muted: #5C6166;
    --line: #F0F1F2;
    --line-strong: #D9DDE1;
    --page: #F5F7F9;
    --surface: #FFFFFF;
    --surface-2: #F7F8F9;
    --disabled-bg: #E3E6E9;
    --disabled-text: #4A4F55;
    --radius: 18px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: 'Poppins', sans-serif; font-size: 15px; line-height: 1.55; }
img { max-width: 100%; display: block; }
a { color: var(--green); }
a:hover { color: var(--green-dark); }
h1, h2, h3, p { margin: 0; }
button, input { font-family: inherit; }
[x-cloak] { display: none !important; }
body.no-scroll { overflow: hidden; }
h1, h2, .chip, .lottery-card__title { overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 16px; }
.brand img { height: 36px; width: auto; }
.site-nav { display: none; align-items: center; gap: 4px; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: none; }
.site-nav a.is-active { background: var(--ink); color: #FFFFFF; }
.header-actions { display: flex; gap: 8px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.icon-btn svg { width: 20px; height: 20px; }
.mobile-menu { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: flex-end; background: rgba(0, 0, 0, 0.5); }
.mobile-menu__panel { width: min(320px, 86vw); height: 100%; background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.mobile-menu__panel a { display: flex; align-items: center; min-height: 48px; padding: 0 16px; border-radius: 12px; background: var(--surface-2); color: var(--ink); text-decoration: none; font-weight: 500; }
.mobile-menu__panel a.is-active { background: var(--ink); color: #FFFFFF; }

/* Page */
.page { padding-top: 20px; padding-bottom: 48px; display: flex; flex-direction: column; gap: 20px; }
.page-intro { display: flex; flex-direction: column; gap: 6px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--green); }
.page-title { font-size: 26px; line-height: 1.25; font-weight: 700; }
.lead { font-size: 15px; color: var(--ink-2); }
.back-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 14px; font-weight: 600; text-decoration: none; }
.back-link svg { width: 18px; height: 18px; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card--pad { padding: 16px; }
.section-title { font-size: 18px; font-weight: 700; }

/* Pills */
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--page); color: var(--ink-2); }
.pill--live { background: var(--green-soft); color: var(--green-dark); }
.pill--soon { background: var(--yellow-soft); color: var(--yellow-text); }
.pill--plain { font-weight: 500; }

/* Poster */
.poster { width: 100%; aspect-ratio: 706 / 320; object-fit: cover; background: var(--surface-2); }
.poster--rounded { border-radius: 16px; }

/* Lottery list */
.lottery-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.lottery-card { display: flex; flex-direction: column; overflow: hidden; }
.lottery-card__body { padding: 16px; display: flex; flex-direction: column; gap: 14px; flex-grow: 1; }
.lottery-card__title { font-size: 19px; line-height: 1.3; font-weight: 700; }
.lottery-card__title a { color: inherit; text-decoration: none; }
.lottery-card__desc { font-size: 14px; color: var(--ink-2); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.fact { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.fact--wide { grid-column: span 2; }
.fact dt { font-size: 12px; color: var(--muted); }
.fact dd { margin: 2px 0 0; font-size: 14px; font-weight: 600; }
.section-links { display: flex; gap: 8px; overflow-x: auto; padding-top: 12px; border-top: 1px solid var(--line); margin-top: auto; }
.section-links a { flex-shrink: 0; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; background: var(--page); color: var(--ink); font-size: 13px; font-weight: 500; text-decoration: none; }

/* Buttons */
.actions { display: flex; flex-direction: column; gap: 8px; }
.btn { min-height: 50px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; border: 1px solid transparent; }
.btn svg { width: 18px; height: 18px; }
.btn--primary { background: var(--green); color: #FFFFFF; }
.btn--primary:hover { background: var(--green-dark); color: #FFFFFF; }
.btn--secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn--secondary:hover { background: var(--surface-2); color: var(--ink); }
.btn--ghost { background: var(--page); color: var(--ink); }
.btn:disabled { background: var(--disabled-bg); border-color: var(--disabled-bg); color: var(--disabled-text); cursor: not-allowed; }

/* Countdown */
.countdown { padding: 12px; border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.countdown__label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.countdown__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; text-align: center; }
.countdown__cell { padding: 6px 0; border-radius: 10px; background: var(--surface); }
.countdown__value { font-size: 20px; font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; }
.countdown__unit { font-size: 11px; color: var(--muted); }

/* Lottery detail */
/* Phone: poster and title, then the join panel, then the tabs. Desktop: the join panel stays on the right. */
.detail { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "aside" "content"; gap: 16px; }
.detail__intro { grid-area: intro; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.detail__content { grid-area: content; min-width: 0; }
.detail__aside { grid-area: aside; display: flex; flex-direction: column; gap: 16px; }
.detail__title { font-size: 22px; line-height: 1.3; font-weight: 700; }
.tabs { display: flex; gap: 4px; padding: 6px; overflow-x: auto; background: var(--surface-2); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.tab { flex-shrink: 0; min-height: 44px; padding: 8px 14px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 600; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--surface); color: var(--green-dark); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
.tab-panel { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.rich-text { font-size: 15px; line-height: 1.7; color: var(--ink-2); overflow-wrap: anywhere; white-space: pre-line; }
.gift-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.gift { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 14px; border: 1px solid var(--line); }
.gift img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; border-radius: 10px; background: var(--surface-2); }
.gift__title { font-size: 13px; font-weight: 600; line-height: 1.35; }
.gift__count { font-size: 12px; font-weight: 600; color: var(--green); }
.list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.list-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); font-size: 14px; }
.list-row--soft { border: 0; background: var(--surface-2); }
.product { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; font-weight: 500; }
.product img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: var(--surface); flex-shrink: 0; }
.winners { width: 100%; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.summary-list { margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.summary-list div { display: flex; justify-content: space-between; gap: 12px; }
.summary-list dt { color: var(--muted); }
.summary-list dd { margin: 0; font-weight: 600; text-align: right; }
.empty { padding: 20px; border-radius: 12px; background: var(--surface-2); text-align: center; font-size: 14px; color: var(--ink-2); }

/* How it works */
.steps { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.step { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--ink-2); }
.step__num { flex-shrink: 0; width: 32px; height: 32px; border-radius: 10px; background: var(--green-soft); color: var(--green-dark); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.step strong { color: var(--ink); }

/* Profile */
.profile-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.avatar { width: 48px; height: 48px; border-radius: 14px; background: var(--green-soft); color: var(--green-dark); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.chips { display: flex; gap: 8px; overflow-x: auto; }
.chip { flex-shrink: 0; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 14px; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: #FFFFFF; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { padding: 14px; }
.stat__label { font-size: 12px; color: var(--muted); }
.stat__value { font-size: 26px; font-weight: 700; }
.receipt { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.receipt__top, .receipt__bottom { display: flex; justify-content: space-between; gap: 12px; }
.receipt__code { font-family: ui-monospace, monospace; font-weight: 600; font-size: 14px; }
.receipt__chances { font-weight: 700; color: var(--green); font-size: 14px; }
.receipt__bottom { font-size: 12px; color: var(--muted); }
.status { padding: 2px 8px; border-radius: 999px; background: var(--surface); color: var(--ink-2); font-weight: 600; }

/* Forms and dialogs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.field input { min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 16px; color: var(--ink); }
.field small { font-size: 12px; color: var(--muted); }
.required { color: #B42318; }
.dialog { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
.dialog__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }
.dialog__panel { position: relative; width: 100%; max-width: 520px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; background: var(--surface); border-radius: 20px 20px 0 0; padding: 20px 16px 24px; display: flex; flex-direction: column; gap: 16px; }
.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog__title { font-size: 18px; font-weight: 700; }
.camera-video { width: 100%; height: 320px; object-fit: cover; border-radius: 14px; background: #000000; }
.camera-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.loading { padding: 48px 0; text-align: center; color: var(--muted); }
.preloader { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; background: rgba(245, 247, 249, 0.85); font-weight: 600; color: var(--ink-2); }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); }
.site-footer__row { padding: 20px 16px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: var(--ink-2); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.site-footer nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; }

@media (min-width: 640px) {
    .lottery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gift-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .actions { flex-direction: row; }
    .actions .btn { flex: 1 1 0; }
    .dialog { align-items: center; padding: 16px; }
    .dialog__panel { border-radius: 20px; padding: 24px; }
}

@media (min-width: 1024px) {
    .container { padding: 0 24px; }
    .site-nav { display: flex; }
    .menu-toggle { display: none; }
    .page { padding-top: 40px; padding-bottom: 64px; gap: 28px; }
    .page-title { font-size: 36px; }
    .detail { grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "intro aside" "content aside"; gap: 24px; align-items: start; }
    .detail__aside { position: sticky; top: 92px; }
    .detail__title { font-size: 30px; }
    .card--pad { padding: 24px; }
    .tab-panel { padding: 24px; }
    .site-footer__row { flex-direction: row; justify-content: space-between; align-items: center; padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; }
}
