/* La Jugada del Día (juego.html). Everything is scoped under .jg-* and uses css/tokens.css
   variables, so light ([data-theme="light"]) and dark both work. Mobile first (390 px). */

/* Text colours are picked for WCAG AA (4.5:1) at the small sizes used here, per theme:
   accent text #fb923c / #c2410c, ok #34d399 / #047857, bad #fb7185 / #be123c, links
   #60a5fa / #1d4ed8 (css/tokens.css keeps --text-link at blue-400 in light: 2.5:1). */
.jg-page {
    --jg-accent: #f97316;
    --jg-accent-text: #fb923c;
    --jg-accent-soft: rgba(249, 115, 22, 0.14);
    --jg-ok: #34d399;
    --jg-ok-bg: var(--success-overlay);
    --jg-bad: #fb7185;
    --jg-bad-bg: var(--danger-surface-faint);
    --jg-link: var(--text-link);
    --jg-badge-bg: #047857;
    --jg-radius: 18px;
}

[data-theme="light"] .jg-page {
    --jg-accent: #ea580c;
    --jg-accent-text: #c2410c;
    --jg-accent-soft: rgba(234, 88, 12, 0.1);
    --jg-ok: #047857;
    --jg-ok-bg: rgba(5, 150, 105, 0.08);
    --jg-bad: #be123c;
    --jg-bad-bg: rgba(225, 29, 72, 0.06);
    --jg-link: var(--color-blue-700, #1d4ed8);
}

.jg-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.jg-theme-toggle {
    background: transparent;
    border: 1px solid var(--border-medium);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
}

.jg-stage,
.jg-reveal,
.jg-card {
    scroll-margin-top: 96px;  /* the header is fixed */
}

.jg-main {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 92px 0 2rem;
}

/* --- hero ------------------------------------------------------------------------ */
.jg-hero {
    text-align: center;
    margin-bottom: 1rem;
}

.jg-kicker {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--jg-accent-text);
    background: var(--jg-accent-soft);
    border-radius: var(--radius-full);
    padding: 0.2rem 0.7rem;
    margin: 0 0 0.5rem;
}

.jg-title {
    font-size: 1.9rem;
    line-height: 1.15;
    font-weight: 800;
    margin: 0;
    color: var(--text-heading);
    letter-spacing: -0.02em;
}

.jg-sub {
    color: var(--text-secondary);
    margin: 0.35rem 0 0.75rem;
    font-size: 0.98rem;
}

.jg-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    min-height: 32px;
}

.jg-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--surface-control);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-full);
    padding: 0.3rem 0.75rem;
    line-height: 1.2;
}

.jg-chip--streak {
    color: var(--jg-accent-text);
    border-color: var(--jg-accent-soft);
    background: var(--jg-accent-soft);
}

/* --- cards ------------------------------------------------------------------------ */
.jg-card {
    background: var(--surface-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--jg-radius);
    padding: 1.1rem 1rem 1.2rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 0.9rem;
}

.jg-h2 {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0 0 0.4rem;
    color: var(--text-heading);
}

.jg-h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--text-heading);
}

.jg-muted {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin: 0 0 0.6rem;
}

.jg-fine {
    color: var(--text-tertiary);
    font-size: 0.78rem;
    line-height: 1.45;
    margin: 0.6rem 0 0;
}

.jg-note {
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--surface-control);
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    padding: 0.55rem 0.75rem;
    margin: 0.8rem 0 0;
}

.jg-note a {
    color: var(--jg-link);
}

.jg-intro {
    text-align: center;
}

.jg-intro-icon {
    width: 64px;
    height: 64px;
    margin: 0.2rem auto 0.6rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--jg-accent);
    background: var(--jg-accent-soft);
}

.jg-rules {
    text-align: left;
    margin: 0.6rem 0 0.4rem;
    padding: 0 0 0 1.1rem;
    color: var(--text-primary);
    font-size: 0.92rem;
    line-height: 1.5;
}

.jg-rules li {
    margin-bottom: 0.35rem;
}

/* --- buttons ---------------------------------------------------------------------- */
.jg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    min-height: 52px;
    border-radius: 14px;
    font: inherit;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: transform 0.12s ease, background 0.2s ease, opacity 0.2s ease;
    margin-top: 0.9rem;
}

.jg-btn:active {
    transform: scale(0.98);
}

.jg-btn--primary {
    background: var(--brand-primary);
    color: #fff;
    box-shadow: 0 6px 18px -6px var(--brand-shadow);
}

.jg-btn--primary:hover {
    background: var(--brand-primary-hover);
}

.jg-btn--ghost {
    background: var(--surface-control);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.jg-btn--ghost:disabled {
    opacity: 0.7;
    cursor: default;
}

.jg-btn--sm {
    min-height: 42px;
    font-size: 0.9rem;
    width: auto;
    padding: 0 0.9rem;
    margin-top: 0;
}

.jg-link-btn {
    background: none;
    border: none;
    font: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--jg-link);
    cursor: pointer;
    padding: 0.4rem 0.2rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.jg-skip {
    text-align: center;
    margin: 0.1rem 0 0.6rem;
}

/* --- round ------------------------------------------------------------------------ */
.jg-round-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.jg-round-num {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.jg-dots {
    display: flex;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.jg-dots li {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-strong);
}

.jg-dots li.is-current {
    background: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-overlay-medium);
}

.jg-dots li.is-ok {
    background: var(--success-accent);
}

.jg-dots li.is-bad {
    background: var(--danger-primary);
}

.jg-product {
    display: flex;
    gap: 0.85rem;
    align-items: center;
}

.jg-product-img {
    flex: 0 0 92px;
    height: 92px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.jg-product-img img {
    max-width: 86%;
    max-height: 86%;
    object-fit: contain;
}

.jg-product-img {
    position: relative;
}

/* placeholder: shown when there is no photo or it fails to load (is-empty) */
.jg-product-ph {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
}

.jg-product-img.is-empty .jg-product-ph {
    display: flex;
}

.jg-product-img.is-empty {
    background: var(--surface-control);
}

.jg-product-text {
    min-width: 0;
}

.jg-cat {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--jg-accent-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.15rem;
}

.jg-product-name {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    color: var(--text-heading);
    overflow-wrap: anywhere;
}

.jg-bank-q {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--jg-accent-text);
    font-weight: 700;
    font-size: 0.9rem;
}

.jg-question {
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--text-heading);
    margin: 0.95rem 0 0.7rem;
    line-height: 1.35;
}

.jg-options {
    display: grid;
    gap: 0.6rem;
}

.jg-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 60px;
    padding: 0.55rem 0.9rem;
    border-radius: 14px;
    border: 2px solid var(--border-medium);
    background: var(--surface-control);
    color: var(--text-primary);
    font: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, background 0.15s ease, opacity 0.2s ease, transform 0.12s ease;
}

.jg-option:not(:disabled):hover {
    border-color: var(--brand-primary);
}

.jg-option:not(:disabled):active {
    transform: scale(0.985);
}

.jg-option:focus-visible {
    outline: 3px solid var(--brand-primary);
    outline-offset: 2px;
}

.jg-option:disabled {
    cursor: default;
}

.jg-option.is-pending {
    border-color: var(--brand-primary);
    opacity: 0.8;
}

.jg-option.is-correct {
    border-color: var(--success-accent);
    background: var(--jg-ok-bg);
}

.jg-option.is-wrong {
    border-color: var(--danger-primary);
    background: var(--jg-bad-bg);
}

.jg-option.is-dim {
    opacity: 0.5;
}

.jg-option-label {
    flex: 1;
}

.jg-option-mark {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex: 0 0 24px;
}

.jg-option.is-correct .jg-option-mark {
    background: var(--success-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 15px no-repeat;
}

.jg-option.is-wrong .jg-option-mark {
    background: var(--danger-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3C/svg%3E") center / 13px no-repeat;
}

.jg-option--region {
    justify-content: center;
    text-align: center;
}

.jg-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: contain;
    background: #fff;
    padding: 3px;
    flex: 0 0 40px;
    border: 1px solid var(--border-subtle);
}

.jg-logo--sm {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    border-radius: 8px;
    padding: 2px;
}

.jg-error {
    color: var(--danger-text);
    font-size: 0.88rem;
    margin: 0.6rem 0 0;
}

/* --- reveal ----------------------------------------------------------------------- */
.jg-reveal {
    margin-top: 0.9rem;
    animation: jg-in 0.25s ease-out;
}

@keyframes jg-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .jg-reveal { animation: none; }
    .jg-btn, .jg-option { transition: none; }
}

.jg-verdict {
    border-radius: 12px;
    padding: 0.6rem 0.8rem;
    font-size: 0.95rem;
    margin-bottom: 0.7rem;
    color: var(--text-primary);
}

.jg-verdict.is-ok {
    background: var(--jg-ok-bg);
    border: 1px solid var(--success-border-soft);
}

.jg-verdict.is-ok strong {
    color: var(--jg-ok);
}

.jg-verdict.is-bad {
    background: var(--jg-bad-bg);
    border: 1px solid rgba(225, 29, 72, 0.25);
}

.jg-verdict.is-bad strong {
    color: var(--jg-bad);
}

.jg-prices {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.35rem;
}

.jg-price-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.55rem;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.jg-price-row.is-best {
    border-color: var(--success-accent);
    background: var(--jg-ok-bg);
}

.jg-price-chain {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.4rem;
}

.jg-price-value {
    font-size: 1.02rem;
    font-weight: 800;
    color: var(--text-heading);
    white-space: nowrap;
    text-align: right;
}

.jg-value-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.jg-badge {
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    background: var(--jg-badge-bg);
    border-radius: var(--radius-full);
    padding: 0.1rem 0.45rem;
}

.jg-promo-fine {
    flex-basis: 100%;
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.35;
}

.jg-insight {
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin: 0.65rem 0 0;
}

.jg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* --- sponsored bonus -------------------------------------------------------------- */
.jg-round--bonus {
    border-color: var(--warning-primary);
}

/* the label is js/ad-slot.js's P9 markup (.ad-presented, styled by css/ads.css) */
.jg-ad-label {
    margin: 0 0 0.35rem;
}

.jg-ad-label .ad-presented {
    font-size: 0.9rem;
    color: var(--text-primary);
    gap: 0.35rem 0.6rem;
}

.jg-ad-label .ad-why-link {
    font-size: 0.8rem;
}

.jg-bonus-note {
    margin: 0 0 0.8rem;
}

.jg-bonus-skip {
    display: block;
    margin: 0.7rem auto 0;
}

/* --- results ---------------------------------------------------------------------- */
.jg-results {
    text-align: center;
}

.jg-results-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}

.jg-score {
    font-size: 3.6rem;
    font-weight: 900;
    line-height: 1.05;
    color: var(--text-heading);
    letter-spacing: -0.03em;
}

.jg-score span {
    font-size: 1.8rem;
    color: var(--text-tertiary);
}

.jg-results-msg {
    margin: 0.3rem 0 0.6rem;
    font-size: 0.98rem;
    color: var(--text-primary);
}

.jg-grid {
    font-size: 1.6rem;
    letter-spacing: 0.15rem;
    line-height: 1.2;
}

.jg-streak {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--jg-accent-text);
    margin: 0.5rem 0 0;
}

.jg-share-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    margin-top: 0.9rem;
}

.jg-share-row .jg-btn--primary {
    margin-top: 0;
    flex: 1;
}

.jg-share-row .jg-btn--sm {
    min-height: 52px;
}

.jg-next {
    font-size: 0.86rem;
    color: var(--text-secondary);
    margin: 0.7rem 0 0;
}

.jg-next span {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--text-primary);
}

.jg-sum-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.4rem;
}

.jg-sum-list li {
    display: grid;
    grid-template-columns: 18px 1fr;
    column-gap: 0.55rem;
    align-items: start;
    font-size: 0.88rem;
}

.jg-sum-mark {
    width: 14px;
    height: 14px;
    margin-top: 4px;
    border-radius: 4px;
    background: var(--danger-primary);
}

.jg-sum-list li.is-ok .jg-sum-mark {
    background: var(--success-accent);
}

.jg-sum-name {
    color: var(--text-primary);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.jg-sum-best {
    grid-column: 2;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* --- skeleton, empty -------------------------------------------------------------- */
.jg-skeleton .jg-sk-line,
.jg-skeleton .jg-sk-block {
    background: linear-gradient(90deg, var(--surface-control) 0%, var(--surface-control-hover) 50%, var(--surface-control) 100%);
    background-size: 200% 100%;
    animation: jg-shimmer 1.4s linear infinite;
    border-radius: 10px;
}

.jg-sk-line {
    height: 14px;
    width: 60%;
    margin: 0.5rem 0;
}

.jg-sk-wide {
    width: 85%;
}

.jg-sk-block {
    height: 150px;
    margin: 0.8rem 0;
}

@keyframes jg-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.jg-empty {
    text-align: center;
}

.jg-noscript {
    text-align: center;
    padding: 1rem;
}

.jg-bank-note {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: -0.2rem 0 0.7rem;
}

@media (min-width: 640px) {
    .jg-title {
        font-size: 2.3rem;
    }

    .jg-card {
        padding: 1.4rem 1.4rem 1.5rem;
    }
}
