/* Popup Hero – a téma változóit használja (tartalékokkal, így más sablonnal is működik) */
.ph, .ph-teaser {
    --ph-accent: var(--jm-accent, #FFEE00);
    --ph-ink: var(--jm-accent-ink, #0a0a0b);
    --ph-bg: var(--jm-surface, #fff);
    --ph-bg2: var(--jm-surface-2, #f1f1f1);
    --ph-text: var(--jm-text, #141416);
    --ph-muted: var(--jm-muted, #66666d);
    --ph-line: var(--jm-line, #ddd);
    --ph-font-d: var(--jm-font-display, inherit);
    --ph-font-c: var(--jm-font-cond, inherit);
    font-family: var(--jm-font, inherit);
    color: var(--ph-text);
}
html.ph-lock { overflow: hidden; }

/* ---------- Felugró (popup, teljes képernyős, kerék, kaparós) ---------- */
.ph--popup, .ph--fullscreen, .ph--wheel, .ph--scratch { position: fixed; inset: 0; z-index: 2200; display: grid; place-items: center; padding: 16px; }
.ph__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .72); opacity: 0; transition: opacity .25s; }
.ph.is-in .ph__backdrop { opacity: 1; }
.ph__card {
    position: relative; width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow: auto; border-radius: 22px;
    background: var(--ph-bg); border: 1px solid var(--ph-line); box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
    transform: translateY(18px) scale(.97); opacity: 0; transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .25s;
}
.ph.is-in .ph__card { transform: none; opacity: 1; }
.ph.is-leaving .ph__card { transform: translateY(12px) scale(.98); opacity: 0; }
.ph.is-leaving .ph__backdrop { opacity: 0; }
.ph--has-img .ph__card { width: min(760px, 100%); display: grid; }
@media (min-width: 640px) { .ph--has-img .ph__card { grid-template-columns: 0.9fr 1.1fr; } }
.ph__media { background: var(--ph-bg2); min-height: 160px; }
.ph__media img { width: 100%; height: 100%; max-height: 260px; object-fit: cover; display: block; }
@media (min-width: 640px) { .ph__media img { max-height: none; } }
.ph__body { padding: 28px 24px 20px; text-align: center; display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.ph__body[hidden] { display: none; }
.ph__title { margin: 0 24px; font-family: var(--ph-font-d); font-weight: 400; font-size: clamp(28px, 6vw, 38px); line-height: 1.02; text-wrap: balance; }
.ph__text { margin: 0; color: var(--jm-text-soft, var(--ph-muted)); line-height: 1.5; }

/* Teljes képernyős */
.ph--fullscreen { padding: 0; }
.ph--fullscreen .ph__backdrop { background: rgba(0, 0, 0, .9); }
.ph--fullscreen .ph__card { width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; display: grid; align-content: center; background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--ph-accent) 18%, var(--ph-bg)), var(--ph-bg) 65%); }
.ph--fullscreen .ph__body { max-width: 560px; margin: 0 auto; }
.ph--fullscreen .ph__title { font-size: clamp(36px, 9vw, 64px); }
.ph--fullscreen.ph--has-img .ph__card { grid-template-columns: 1fr; }

/* Oldalsó üzenet */
.ph--slide { position: fixed; z-index: 2150; bottom: 16px; right: 16px; width: min(360px, calc(100% - 32px)); }
.ph--slide.ph--bottom-left { right: auto; left: 16px; }
.ph--slide .ph__card { width: 100%; transform: translateY(30px); box-shadow: 0 18px 50px rgba(0, 0, 0, .45); }
.ph--slide .ph__body { padding: 20px 18px 14px; }
.ph--slide .ph__title { font-size: 26px; }
@media (max-width: 991px) { .ph--slide { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* Sáv */
.ph--bar { position: relative; z-index: 1050; display: flex; align-items: center; background: var(--ph-accent); color: var(--ph-ink); }
.ph--bar.ph--bottom { position: fixed; left: 0; right: 0; bottom: 0; box-shadow: 0 -6px 20px rgba(0, 0, 0, .25); }
@media (max-width: 991px) { .ph--bar.ph--bottom { bottom: calc(64px + env(safe-area-inset-bottom)); } }
.ph-bar__inner { flex: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px; padding: 8px 12px; text-align: center; font-weight: 700; font-size: 14px; }
.ph-bar__text small { font-weight: 500; opacity: .8; margin-left: 6px; }
.ph--bar .ph-btn--sm { min-height: 32px; padding: 0 14px; font-size: 13px; background: var(--ph-ink); color: var(--ph-accent); }
.ph--bar .ph-code { padding: 3px 10px; border: 1.5px dashed currentColor; background: transparent; color: inherit; font-weight: 800; letter-spacing: .08em; }
.ph-x--bar { position: relative !important; top: auto !important; right: auto !important; flex: none; margin-right: 6px; background: transparent !important; color: inherit !important; }
.ph--bar { transform: translateY(-100%); transition: transform .3s; }
.ph--bar.ph--bottom { transform: translateY(100%); }
.ph--bar.is-in { transform: none; }

/* Bezáró, gombok */
.ph-x { position: absolute; top: 10px; right: 10px; z-index: 2; width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 10px; background: var(--ph-bg2); color: var(--ph-text); cursor: pointer; }
.ph-x svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.ph-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 22px; border: 0; border-radius: 12px;
    background: var(--ph-accent); color: var(--ph-ink); font-family: var(--ph-font-c); font-weight: 700; font-size: 18px; letter-spacing: .04em; text-transform: uppercase;
    text-decoration: none; cursor: pointer; transition: transform .12s, filter .15s;
}
.ph-btn:hover { color: var(--ph-ink); filter: brightness(1.05); }
.ph-btn:active { transform: scale(.97); }
.ph-btn.is-loading { opacity: .6; pointer-events: none; }
.ph-later { align-self: center; border: 0; background: none; color: var(--ph-muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 4px; }
.ph-msg { margin: 0; color: var(--jm-sale, #c8261a); font-weight: 600; font-size: 14px; }

/* Űrlap */
.ph-form { display: grid; gap: 10px; text-align: left; }
.ph-form[hidden] { display: none; }
.ph-field { display: grid; gap: 4px; margin: 0; font-size: 13px; font-weight: 600; color: var(--ph-muted); }
.ph-field input { height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--ph-line); background: var(--jm-bg, #fff); color: var(--ph-text); font-size: 16px; }
.ph-field input:focus { outline: 2px solid var(--ph-accent); outline-offset: 1px; }
.ph-consent { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; margin: 0; font-size: 12px; color: var(--ph-muted); line-height: 1.4; }
.ph-consent input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--ph-accent); }

/* Kupon */
.ph-code { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; border: 2px dashed var(--ph-accent); border-radius: 12px; background: color-mix(in srgb, var(--ph-accent) 10%, transparent); color: var(--ph-text); cursor: pointer; }
.ph-code--big { padding: 10px 16px; }
.ph-code--big span { font-family: var(--ph-font-c); font-size: 26px; font-weight: 800; letter-spacing: .12em; }
.ph-code small { color: var(--ph-muted); font-size: 12px; }
.ph-code.is-copied { border-style: solid; }
.ph-code[hidden] { display: none; }

/* Visszaszámláló */
.ph-cd { display: grid; gap: 2px; }
.ph-cd small { color: var(--ph-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.ph-cd b { font-family: var(--ph-font-c); font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.ph-cd--inline { font-variant-numeric: tabular-nums; }
.ph-cd[hidden] { display: none; }

/* Kérdőív */
.ph-survey { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.ph-survey legend { font-weight: 700; margin-bottom: 4px; }
.ph-opt { min-height: 44px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--ph-line); background: var(--ph-bg2); color: var(--ph-text); font-weight: 600; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.ph-opt:hover, .ph-opt.is-on { border-color: var(--ph-accent); background: color-mix(in srgb, var(--ph-accent) 14%, var(--ph-bg)); }

/* Szerencsekerék */
.ph-wheel { position: relative; width: min(280px, 72vw); margin: -6px auto 4px; }
.ph-wheel__svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .35)); }
.ph-wheel__seg--a { fill: var(--ph-accent); }
.ph-wheel__seg--b { fill: #1b1b1e; }
.ph-wheel__seg { stroke: var(--ph-bg); stroke-width: 2; }
.ph-wheel__label { font: 700 13px var(--ph-font-c, sans-serif); letter-spacing: .02em; }
.ph-wheel__seg--a + .ph-wheel__label { fill: #0a0a0b; }
.ph-wheel__seg--b + .ph-wheel__label { fill: #fff; }
.ph-wheel__hub { fill: var(--ph-bg); stroke: var(--ph-accent); stroke-width: 6; }
.ph-wheel__pin { position: absolute; left: 50%; top: -6px; z-index: 2; width: 0; height: 0; transform: translateX(-50%); border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 26px solid #ef4444; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .4)); }

/* Kaparós sorsjegy */
.ph-scratch { position: relative; width: min(300px, 100%); aspect-ratio: 300 / 120; margin: 0 auto; border-radius: 14px; overflow: hidden; background: color-mix(in srgb, var(--ph-accent) 22%, var(--ph-bg)); border: 2px solid var(--ph-accent); }
.ph-scratch[hidden] { display: none; }
.ph-scratch__prize { position: absolute; inset: 0; display: grid; place-items: center; padding: 10px; font-family: var(--ph-font-c); font-size: 24px; font-weight: 800; text-align: center; }
.ph-scratch__cover { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }

/* Ajánló fül */
.ph-teaser {
    position: fixed; z-index: 2100; left: 16px; bottom: 16px; display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 16px 0 12px;
    border: 0; border-radius: 999px; background: var(--ph-accent); color: var(--ph-ink); font-weight: 800; font-size: 14px; cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35); transform: translateY(80px); transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
.ph-teaser.is-in { transform: none; }
.ph-teaser svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ph-teaser:hover { filter: brightness(1.05); }
@media (max-width: 991px) { .ph-teaser { bottom: calc(76px + env(safe-area-inset-bottom)); left: 12px; } }

/* Mobil: a felugró alulról jövő lapként */
@media (max-width: 575px) {
    .ph--popup, .ph--wheel, .ph--scratch { place-items: end center; padding: 0; }
    .ph--popup .ph__card, .ph--wheel .ph__card, .ph--scratch .ph__card { width: 100%; border-radius: 22px 22px 0 0; max-height: 92dvh; transform: translateY(100%); padding-bottom: env(safe-area-inset-bottom); }
    .ph.is-in .ph__card { transform: none; }
    .ph.is-leaving .ph__card { transform: translateY(100%); }
}
@media (prefers-reduced-motion: reduce) {
    .ph__card, .ph__backdrop, .ph--bar, .ph-teaser { transition: none !important; }
}

/* Termékajánló kártyák */
.ph-recs__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.ph-rec { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-areas: "img name add" "img price add"; gap: 2px 10px; align-items: center; padding: 8px; border-radius: 14px; border: 1px solid var(--ph-line); background: var(--jm-bg, var(--ph-bg2)); }
.ph-rec__img { grid-area: img; width: 56px; height: 56px; border-radius: 10px; background: #fff; overflow: hidden; }
.ph-rec__img img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.ph-rec__name { grid-area: name; color: var(--ph-text); font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-decoration: none; }
.ph-rec__name:hover { color: var(--ph-text); text-decoration: underline; }
.ph-rec__price { grid-area: price; font-family: var(--ph-font-d); font-weight: 400; font-size: 18px; }
.ph-rec__add { grid-area: add; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--ph-accent); color: var(--ph-ink); font-weight: 800; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: transform .12s, background .2s; }
.ph-rec__add:active { transform: scale(.95); }
.ph-rec__add svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ph-rec__add.is-loading { opacity: .6; }
.ph-rec__add.is-added { background: var(--jm-success, #16a34a); color: #fff; }
.ph-rec__add--ghost { background: transparent; border: 1px solid var(--ph-line); color: var(--ph-text); }
@media (max-width: 420px) { .ph-rec__add span { display: none; } .ph-rec__add.is-added span { display: inline; } }
.ph--slide .ph-recs__list { max-height: 50vh; overflow: auto; }

/* Bezáró gomb késleltetése: visszaszámláló gyűrű a gomb helyén */
.ph-x__count { display: none; }
.ph-x.is-wait { cursor: default; }
.ph-x.is-wait svg { opacity: 0; }
.ph-x.is-wait .ph-x__count { display: grid; place-items: center; position: absolute; inset: 0; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ph-x.is-wait::after {
    content: ""; position: absolute; inset: 4px; border-radius: 50%;
    background: conic-gradient(var(--ph-accent) calc(var(--ph-p, 0) * 1turn), rgba(127, 127, 127, .25) 0);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
}
.ph-x:not(.is-wait) svg { transition: opacity .25s; }
