/* Chabad Show games corner. Uses the theme's colours when they exist. */

.csg { --csg-ink: var(--text, #1b1530); --csg-muted: var(--muted, #6a6578); --csg-soft: var(--surface-2, #f4f2f8); --csg-color: #5b2a86; --csg-gold: #f2b632; }

/* ---------- Hub ---------- */
.csg-hero { background: linear-gradient(160deg, #5a2a88 0%, #2b1446 100%); color: #fff; padding: 44px 0 52px; text-align: center; position: relative; overflow: hidden; }
.csg-hero::before, .csg-hero::after { content: "★"; position: absolute; color: rgb(242 182 50 / 30%); font-size: 120px; line-height: 1; }
.csg-hero::before { top: -20px; right: 6%; transform: rotate(14deg); }
.csg-hero::after { bottom: -40px; left: 8%; font-size: 160px; transform: rotate(-12deg); }
.csg-hero__kicker { margin: 0 0 6px; color: var(--csg-gold); font-weight: 800; font-size: 15px; }
.csg-hero__title { font-size: clamp(36px, 8vw, 56px); font-weight: 800; color: #fff; margin: 0; }
.csg-hero__text { max-width: 560px; margin: 12px auto 0; font-size: 17px; color: rgb(255 255 255 / 82%); }

.csg-grid { display: grid; gap: 22px; padding-block: 32px 48px; }
@media (min-width: 700px) { .csg-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .csg-grid { grid-template-columns: repeat(3, 1fr); } }
.csg-card { display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; background: var(--surface, #fff); border: 1px solid var(--line, #e8e5ee); color: var(--csg-ink); box-shadow: 0 8px 24px rgb(43 20 70 / 8%); transition: transform .2s ease, box-shadow .2s ease; }
a.csg-card:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgb(43 20 70 / 16%); color: var(--csg-ink); }
.csg-card__media { aspect-ratio: 16 / 10; background: var(--csg-color); display: block; }
.csg-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.csg-card__body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px 20px 22px; flex: 1; }
.csg-card__ages { font-size: 13px; font-weight: 700; color: var(--csg-color); background: var(--csg-soft); padding: 2px 10px; border-radius: 999px; }
.csg-card__title { font-family: var(--font-head, inherit); font-size: 22px; font-weight: 800; line-height: 1.25; }
.csg-card__text { color: var(--csg-muted); font-size: 15.5px; line-height: 1.5; }
.csg-card__btn { margin-top: auto; padding: 10px 20px; border-radius: 10px; background: var(--csg-color); color: #fff; font-weight: 800; font-size: 15px; }
.csg-card--soon { border-style: dashed; box-shadow: none; background: var(--csg-soft); justify-content: center; text-align: center; min-height: 200px; }
.csg-card--soon .csg-card__body { align-items: center; justify-content: center; }

/* ---------- Game page ---------- */
.csg-play { padding-block: 18px 40px; }
.csg-crumbs { font-size: 14px; color: var(--csg-muted); margin-bottom: 6px; }
.csg-crumbs a { color: var(--csg-color); font-weight: 700; }
.csg-play__title { font-size: clamp(26px, 6vw, 36px); font-weight: 800; margin: 0 0 14px; text-align: center; }

.csg-stage { position: relative; width: 100%; max-width: 460px; margin-inline: auto; aspect-ratio: 4 / 7; max-height: calc(100vh - 140px); max-height: calc(100dvh - 140px); border-radius: 20px; overflow: hidden; background: #2b2f38; box-shadow: 0 16px 40px rgb(43 20 70 / 25%); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
@supports (aspect-ratio: 1) { .csg-stage { width: min(100%, 460px, calc((100dvh - 140px) * 4 / 7)); } }
.csg-stage--free { aspect-ratio: auto; max-height: none; max-width: 980px; width: 100%; overflow: visible; background: transparent; box-shadow: none; border-radius: 0; touch-action: auto; user-select: auto; -webkit-user-select: auto; }
@supports (aspect-ratio: 1) { .csg-stage.csg-stage--free { width: 100%; } }
.csg-stage--tall canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.csg-overlay { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 26px; text-align: center; color: #fff; background: radial-gradient(circle at 50% 30%, rgb(91 42 134 / 92%), rgb(28 15 51 / 96%)); }
.csg-overlay[hidden] { display: none; }
.csg-overlay h2 { margin: 0; font-size: 30px; font-weight: 800; color: #fff; line-height: 1.15; }
.csg-overlay p { margin: 0; font-size: 16px; color: rgb(255 255 255 / 85%); max-width: 320px; line-height: 1.5; }
.csg-overlay__art { width: 150px; height: auto; }
.csg-overlay__big { font-family: var(--font-head, inherit); font-size: 56px; font-weight: 800; color: var(--csg-gold); line-height: 1; }
.csg-overlay__stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.csg-overlay__stats span { background: rgb(255 255 255 / 12%); border-radius: 12px; padding: 8px 12px; font-size: 14px; font-weight: 700; }
.csg-overlay__stats b { display: block; font-size: 22px; color: #fff; }
.csg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 14px 30px; font: inherit; font-weight: 800; font-size: 19px; cursor: pointer; background: var(--csg-gold); color: #2b1446; box-shadow: 0 5px 0 #b9831a; transition: transform .1s ease, box-shadow .1s ease; }
.csg-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #b9831a; }
.csg-btn--ghost { background: rgb(255 255 255 / 14%); color: #fff; box-shadow: none; font-size: 16px; padding: 10px 20px; }
.csg-btn--wa { background: #1faa55; color: #fff; box-shadow: 0 5px 0 #0f7a37; font-size: 16px; padding: 11px 22px; }
.csg-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.csg-best { font-size: 14px; color: var(--csg-gold); font-weight: 700; }

.csg-hud-btn { position: absolute; top: 10px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgb(0 0 0 / 35%); color: #fff; font-size: 17px; display: grid; place-items: center; cursor: pointer; }
.csg-hud-btn--pause { left: 10px; }
.csg-hud-btn--sound { left: 54px; }

.csg-pad { display: none; gap: 12px; max-width: 460px; margin: 12px auto 0; }
.csg-pad button { flex: 1; height: 62px; border-radius: 16px; border: 0; background: var(--csg-color); color: #fff; font-size: 28px; font-weight: 800; box-shadow: 0 5px 0 #2b1446; touch-action: manipulation; }
.csg-pad button:active { transform: translateY(4px); box-shadow: 0 1px 0 #2b1446; }
@media (hover: none) and (pointer: coarse) { .csg-pad { display: flex; } .csg-stage { max-height: calc(100dvh - 220px); } @supports (aspect-ratio: 1) { .csg-stage { width: min(100%, 460px, calc((100dvh - 220px) * 4 / 7)); } } }

.csg-how { max-width: 640px; margin: 28px auto 0; background: var(--csg-soft); border-radius: 18px; padding: 22px 24px; }
.csg-how h2 { font-size: 22px; font-weight: 800; margin: 0 0 8px; }
.csg-how p { margin: 0 0 10px; color: var(--csg-ink); }
.csg-how ul { margin: 0 0 14px; padding-inline-start: 20px; color: var(--csg-muted); }
.csg-how li { margin-bottom: 4px; }
.csg-back { font-weight: 800; color: var(--csg-color); }

.csg-game-page .ticker { display: none; }

/* ---------- High-score table (assets/board.js) ---------- */
.csg-board { max-width: 640px; margin: 28px auto 0; background: var(--surface, #fff); border: 1px solid var(--line, #e8e5ee); border-radius: 18px; padding: 20px 22px; box-shadow: 0 8px 24px rgb(43 20 70 / 8%); scroll-margin-top: 90px; color: var(--csg-ink); }
.csg-board:empty { display: none; }
.csg-board__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 10px; }
.csg-board__head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.csg-board__who { font-size: 14.5px; color: var(--csg-muted); }
.csg-board__who b { color: var(--csg-ink); }
.csg-link { border: 0; background: none; padding: 2px 0; font: inherit; font-weight: 800; color: var(--csg-color); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.csg-link--muted { color: var(--csg-muted); font-weight: 600; }
.csg-board__note { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; font-weight: 600; line-height: 1.55; background: var(--csg-soft); }
.csg-board__note[hidden] { display: none; }
.csg-board__note.is-good { background: #e3f6ea; color: #13532f; }
.csg-board__note.is-bad { background: #fdeceb; color: #7d1f1a; }
.csg-board__note .csg-btn { margin-inline-start: 6px; vertical-align: middle; }
.csg-board__form { display: grid; gap: 6px; margin-bottom: 14px; padding: 14px; border-radius: 14px; background: #fff8e6; border: 2px solid var(--csg-gold); }
.csg-board__form[hidden] { display: none; }
.csg-board__form label { font-weight: 800; }
.csg-board__form small { color: var(--csg-muted); font-size: 13px; }
.csg-board__inline { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; }
.csg-board__inline input { flex: 1; min-width: 150px; font: inherit; font-size: 16px; padding: 9px 12px; border-radius: 10px; border: 2px solid var(--line, #ddd7e6); background: #fff; color: inherit; }
.csg-board__inline .csg-btn, .csg-btn--small { font-size: 15px; padding: 9px 18px; box-shadow: 0 3px 0 #b9831a; }
.csg-btn--wa.csg-btn--small { box-shadow: 0 3px 0 #0f7a37; }
.csg-board__err { margin: 0; color: #b0261e; font-weight: 700; font-size: 14px; }
.csg-board__err[hidden] { display: none; }

.csg-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: thin; }
.csg-tab { flex: none; border: 0; border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 14.5px; font-weight: 700; background: var(--csg-soft); color: var(--csg-ink); cursor: pointer; white-space: nowrap; }
.csg-tab[aria-selected="true"] { background: var(--csg-color); color: #fff; }
.csg-board__body { min-height: 80px; transition: opacity .2s; }
.csg-board__body.is-loading { opacity: .5; }
.csg-board__empty { margin: 0; padding: 18px 8px; text-align: center; color: var(--csg-muted); }
.csg-board__foot { margin: 8px 0 0; font-size: 12.5px; color: var(--csg-muted); text-align: center; }

.csg-lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.csg-lb li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; background: var(--csg-soft); }
.csg-lb li:nth-child(-n+3) { background: #fff6dc; }
.csg-lb li.is-me { outline: 2px solid var(--csg-color); background: #f1e9fb; }
.csg-lb__rank { flex: none; width: 30px; text-align: center; font-weight: 800; font-size: 18px; color: var(--csg-muted); font-variant-numeric: tabular-nums; }
.csg-lb__name { flex: 1; min-width: 0; font-weight: 800; overflow-wrap: anywhere; }
.csg-lb__name em { font-style: normal; font-weight: 600; color: var(--csg-color); font-size: 13px; }
.csg-lb__name small { display: block; font-weight: 500; font-size: 12.5px; color: var(--csg-muted); }
.csg-lb__score { flex: none; font-weight: 800; font-size: 19px; color: var(--csg-ink); font-variant-numeric: tabular-nums; }
.csg-lb__mine { margin: 8px 0 0; padding: 8px 12px; border-radius: 12px; border: 2px dashed var(--csg-color); text-align: center; }
.csg-lb--hist li:nth-child(-n+3) { background: var(--csg-soft); }
.csg-lb--hist li.is-me { outline: 0; background: #fff6dc; }

.csg-ghead { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 10px; padding: 10px 12px; border-radius: 12px; background: #eef6fb; font-size: 14.5px; }
.csg-ghead b { font-size: 18px; letter-spacing: .12em; }

.csg-hist__stats { display: flex; gap: 8px; margin-bottom: 12px; }
.csg-hist__stats span { flex: 1; text-align: center; padding: 8px 4px; border-radius: 12px; background: var(--csg-soft); font-size: 13px; color: var(--csg-muted); }
.csg-hist__stats b { display: block; font-size: 22px; color: var(--csg-ink); font-variant-numeric: tabular-nums; }
.csg-hist__chart { display: flex; align-items: flex-end; gap: 4px; height: 110px; padding: 6px 4px 0; border-bottom: 2px solid var(--line, #e1dce9); }
.csg-hist__chart span { flex: 1; max-width: 26px; height: var(--h); background: var(--csg-color); opacity: .55; border-radius: 5px 5px 0 0; }
.csg-hist__chart span.is-best { background: var(--csg-gold); opacity: 1; }

.csg-groups { margin-top: 16px; border-top: 1px solid var(--line, #e8e5ee); padding-top: 12px; }
.csg-groups summary { cursor: pointer; font-weight: 800; color: var(--csg-color); }
.csg-groups p { font-size: 14.5px; color: var(--csg-muted); margin: 8px 0 10px; }
@media (max-width: 480px) { .csg-board { padding: 16px 14px; } .csg-lb li { gap: 8px; padding: 8px 10px; } }
.csg-btn--board { background: var(--csg-color); color: #fff; box-shadow: 0 5px 0 rgb(0 0 0 / 28%); font-size: 16px; padding: 11px 22px; text-decoration: none; }
.csg-btn--board:hover, .csg-btn--board:focus { color: #fff; }
.csg-overlay .csg-btn--board { background: rgb(255 255 255 / 16%); box-shadow: none; }
.csg-subs { display: flex; gap: 0; margin-bottom: 10px; border: 2px solid var(--csg-color); border-radius: 12px; overflow: hidden; }
.csg-subs[hidden] { display: none; }
.csg-subs button { flex: 1; border: 0; padding: 8px 6px; font: inherit; font-size: 14px; font-weight: 800; background: transparent; color: var(--csg-color); cursor: pointer; }
.csg-subs button + button { border-inline-start: 2px solid var(--csg-color); }
.csg-subs button[aria-pressed="true"] { background: var(--csg-color); color: #fff; }

/* ---------- Full screen (assets/play.js) ---------- */
.csg-fsbar { display: flex; justify-content: flex-end; max-width: 980px; margin: 0 auto 8px; }
.csg-fs-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 14px; font-weight: 800; background: var(--csg-soft); color: var(--csg-ink); cursor: pointer; }
.csg-fs-btn span[aria-hidden] { font-size: 17px; line-height: 1; }
.csg-fs-btn:hover { background: var(--csg-color); color: #fff; }
html.csg-fs-lock { overflow: hidden; }
.csg-fswrap.is-fs { position: fixed; inset: 0; z-index: 100000; overflow-y: auto; overscroll-behavior: contain; background: var(--bg, #fff); padding: 10px 12px max(14px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.csg-fswrap.is-fs .csg-fsbar { width: 100%; margin-bottom: 8px; }
.csg-fswrap.is-fs .csg-fs-btn { background: var(--csg-color); color: #fff; }
.csg-fswrap.is-fs .csg-stage { margin-inline: auto; }
.csg-fswrap.is-fs .csg-stage--tall { max-width: 520px; max-height: calc(100dvh - 70px); }
@supports (aspect-ratio: 1) { .csg-fswrap.is-fs .csg-stage--tall { width: min(100%, 520px, calc((100dvh - 70px) * 4 / 7)); } }
@media (hover: none) and (pointer: coarse) {
	.csg-fswrap.is-fs .csg-stage--tall { max-height: calc(100dvh - 150px); }
	@supports (aspect-ratio: 1) { .csg-fswrap.is-fs .csg-stage--tall { width: min(100%, 520px, calc((100dvh - 150px) * 4 / 7)); } }
}
/* The escape room is a wide picture: keep the whole room on screen. */
.csg-fswrap.is-fs .csg-stage[data-csg-game="heder-bricha"] { max-width: min(100%, calc((100dvh - 130px) * 16 / 9)); }
.csg-fswrap:fullscreen { background: var(--bg, #fff); }
