/* ─── Shared level/stage select screen (wwwroot/js/game-select.js) ───────────
   Warm white ground, one accent per game (--gs-accent, set inline by the JS),
   Heebo. Everything is scoped under .gs / .gs-hero so a game's own CSS stays out. */

.gs, .gs-hero {
    --gs-accent: #3730A3;
    --gs-ink: #1C1B22;
    --gs-ink-2: #5E5B66;
    --gs-ink-3: #6F6C77;
    --gs-line: #E6E3DC;
    --gs-muted: #F1EFEA;
    --gs-gold-bg: #FBF3E2;
    --gs-gold-ink: #8A4B06;
    font-family: Heebo, system-ui, sans-serif;
    color: var(--gs-ink);
    direction: rtl;
    box-sizing: border-box;
}
.gs *, .gs-hero * { box-sizing: border-box; }

.gs {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 14px 16px 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: right;
}

/* top row */
.gs-top { display: flex; align-items: center; gap: 10px; }
.gs-title { margin: 0; font-size: 22px; font-weight: 800; flex-grow: 1; color: var(--gs-ink); }
.gs-instr {
    height: 40px; padding: 0 14px; border-radius: 12px; background: #fff; border: 1px solid var(--gs-line);
    display: inline-flex; align-items: center; gap: 6px; font: 600 14px Heebo, system-ui, sans-serif;
    color: var(--gs-ink); cursor: pointer;
}
.gs-instr svg { width: 16px; height: 16px; }
.gs-instr:hover { border-color: var(--gs-accent); color: var(--gs-accent); }

/* progress header */
.gs-hero {
    background: #fff; border: 1px solid var(--gs-line); border-radius: 18px; padding: 16px;
    display: flex; align-items: center; justify-content: center; gap: 16px;
}
.gs-ring {
    --pct: 0; width: 84px; height: 84px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center;
    background: conic-gradient(var(--gs-accent) calc(var(--pct) * 1%), #ECE8E0 0);
}
.gs-ring > div {
    width: 66px; height: 66px; border-radius: 50%; background: #fff;
    display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1;
}
.gs-ring b { font-size: 19px; font-weight: 800; color: var(--gs-ink); }
.gs-ring small { font-size: 11.5px; color: var(--gs-ink-2); }
.gs-hero-info { display: flex; flex-direction: column; gap: 10px; text-align: right; }
.gs-hero-count { font-size: 18px; font-weight: 800; color: var(--gs-ink); }
.gs-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.gs-chip {
    height: 32px; padding: 0 12px; border-radius: 999px; background: var(--gs-gold-bg); color: var(--gs-gold-ink);
    font: 700 14px Heebo, system-ui, sans-serif; display: inline-flex; align-items: center; gap: 6px; border: none;
}
.gs-chip svg { width: 15px; height: 15px; }
.gs-chip i { display: inline-flex; }
button.gs-collect { cursor: pointer; background: #D97706; color: #fff; box-shadow: 0 2px 8px rgba(217,119,6,.35); }
button.gs-collect:hover { background: #B45309; }

/* levels — every level is a clearly framed card; cards in one row share a height */
.gs-levels {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 16px;
    align-items: stretch;
}
.gs-level {
    background: #fff;
    border: 2px solid #D6D0C4;
    border-radius: 18px;
    box-shadow: 0 2px 0 #E4DFD5, 0 8px 20px rgba(28,27,34,.06);
    overflow: hidden;
    display: flex; flex-direction: column;
}
.gs-level.complete { border-color: #6CC593; box-shadow: 0 2px 0 #CDEBD9, 0 8px 20px rgba(22,128,61,.08); }
.gs-level.locked { background: #FBFAF8; border-color: #E2DDD3; box-shadow: none; }
.gs-level-head {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    border-bottom: 2px solid #ECE7DD;
    background: color-mix(in srgb, var(--gs-accent) 5%, #fff);
}
.gs-level.complete .gs-level-head { background: #F1FBF5; border-bottom-color: #D3EEDD; }
.gs-level.locked .gs-level-head { background: #F6F4EF; }
.gs-badge {
    width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800;
    background: #fff; color: var(--gs-accent);
    border: 2px solid color-mix(in srgb, var(--gs-accent) 30%, #fff);
}
.gs-level.complete .gs-badge { background: #16A34A; border-color: #16A34A; color: #fff; }
.gs-level.locked .gs-badge { background: var(--gs-muted); border-color: #E2DDD3; color: #8A8792; }
.gs-badge svg { width: 17px; height: 17px; }
.gs-level-titles { display: flex; flex-direction: column; flex-grow: 1; min-width: 0; gap: 1px; }
.gs-level-titles b { font-size: 17px; font-weight: 800; color: var(--gs-ink); line-height: 1.25; }
.gs-level-titles small { font-size: 13px; font-weight: 600; color: #4E4B57; }
.gs-level.complete .gs-level-titles small { color: #15803D; }
.gs-level.locked .gs-level-titles b { color: #5E5B66; }

/* end-of-level gift (picture: wwwroot/images/GameSelect/gift.webp) */
.gs-gift {
    position: relative; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.gs-gift-img { width: 46px; height: 46px; object-fit: contain; display: block; }
.gs-gift.ready {
    height: 48px; padding: 0 10px 0 6px; border-radius: 14px; cursor: pointer;
    border: 2px solid #E9B949; background: #FFF7E3; color: #8A4B06;
    font: 800 14px Heebo, system-ui, sans-serif;
    animation: gs-gift-pulse 1.8s ease-in-out infinite;
}
.gs-gift.ready .gs-gift-img { width: 40px; height: 40px; }
.gs-gift.ready:hover { background: #FFEFC2; }
.gs-gift.locked .gs-gift-img { filter: grayscale(1); opacity: .38; }
.gs-gift-check {
    position: absolute; bottom: -2px; left: -2px; width: 20px; height: 20px; border-radius: 50%;
    background: #16A34A; color: #fff; border: 2px solid #fff;
    display: flex; align-items: center; justify-content: center;
}
.gs-gift-check svg { width: 11px; height: 11px; }
@keyframes gs-gift-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* stage tiles — one width for the whole screen (--gs-cols set by the JS); a level with
   fewer tiles keeps them centred, so short and long levels line up */
.gs-stages {
    --gs-gap: 10px;
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 14px;
    background: #F8F6F1;
}
/* --gs-per tiles a row, each as wide as one column of a --gs-cols grid */
.gs-stage-wrap {
    width: calc(var(--gs-per, 4) * (100% + var(--gs-gap)) / var(--gs-cols, 4) - var(--gs-gap));
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: var(--gs-gap);
}
.gs-stage {
    position: relative;
    flex: 0 0 calc((100% - (var(--gs-per, 4) - 1) * var(--gs-gap)) / var(--gs-per, 4));
    height: 98px; border-radius: 14px;
    border: 2px solid #D9D3C7; background: #fff; color: var(--gs-ink);
    box-shadow: 0 2px 0 #E2DDD2;
    font-family: Heebo, system-ui, sans-serif; padding: 8px 4px 8px; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    transition: transform .12s ease, box-shadow .12s ease;
}
.gs-stage:hover:not(.locked) { transform: translateY(-2px); box-shadow: 0 2px 0 #E2DDD2, 0 8px 18px rgba(28,27,34,.10); }
.gs-stage.done {
    background: #ECFBF2; border-color: #7FD3A2; box-shadow: 0 2px 0 #C6EBD5;
}
.gs-stage.current {
    border: 2.5px solid var(--gs-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--gs-accent) 16%, transparent), 0 2px 0 #E2DDD2;
}
.gs-stage.locked { background: #F1EFEA; border-color: #E2DDD3; box-shadow: none; color: #8A8792; cursor: not-allowed; }
.gs-done-check {
    position: absolute; top: -8px; left: -8px; width: 24px; height: 24px; border-radius: 50%;
    background: #16A34A; color: #fff; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18);
    display: flex; align-items: center; justify-content: center;
}
.gs-done-check svg { width: 13px; height: 13px; }
.gs-stage-label { font-size: 12.5px; font-weight: 700; color: #4E4B57; }
.gs-stage.done .gs-stage-label { color: #166534; }
.gs-stage.locked .gs-stage-label { color: #8A8792; }
.gs-stage-body { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.gs-stage-body b { font-size: 21px; font-weight: 800; direction: ltr; color: var(--gs-ink); }
.gs-stage.done .gs-stage-body b { color: #14532D; }
.gs-stage-body small { font-size: 12px; font-weight: 600; color: #4E4B57; }
.gs-stage.done .gs-stage-body small { color: #2F6B45; }
.gs-stage-lock svg { width: 22px; height: 22px; }
.gs-stage-foot { min-height: 14px; font-size: 12.5px; font-weight: 800; }
.gs-play { color: var(--gs-accent); }
.gs-stage.open .gs-play { opacity: .8; }
.gs-again { color: #15803D; font-weight: 700; }
.gs-stars { display: flex; gap: 1px; }
.gs-stars svg, .gs-chip i svg { width: 12px; height: 12px; }
.gs-chip i svg { width: 15px; height: 15px; }
.gs-star-on svg { fill: #D97706; stroke: #D97706; }
.gs-star-off svg { fill: #D9D5CC; stroke: #D9D5CC; }

/* a single level (category picker, no levels): one full-width card, symmetric with the
   header above, with somewhat larger tiles centred inside it */
.gs-levels.gs-single { grid-template-columns: 1fr; }
.gs-single .gs-level-head { padding: 14px 18px; }
.gs-single .gs-stages { --gs-gap: 14px; padding: 22px 18px; }
.gs-single .gs-stage-wrap {
    width: min(100%, calc(var(--gs-per, 4) * 220px + (var(--gs-per, 4) - 1) * var(--gs-gap)));
}
.gs-single .gs-stage { height: 120px; padding: 10px 6px; border-radius: 16px; }
.gs-single .gs-stage-label { font-size: 14px; }
.gs-single .gs-stage-body b { font-size: 26px; }
.gs-single .gs-stage-body small { font-size: 14px; }
.gs-single .gs-stage-foot { font-size: 14px; }
@media (max-width: 520px) {
    .gs-single .gs-stages { --gs-gap: 10px; padding: 16px 12px; }
    .gs-single .gs-stage { height: 108px; }
}

.gs-footer { display: flex; justify-content: center; gap: 18px; padding-top: 4px; }
.gs-link {
    background: none; border: none; padding: 8px; cursor: pointer;
    font: 500 13px Heebo, system-ui, sans-serif; color: var(--gs-ink-2); text-decoration: underline;
}

.gs-shake { animation: gs-shake .35s ease; }
@keyframes gs-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* the screen that hosts the select list: soft lilac ground with two faint colour washes */
.gs-screen {
    background:
        radial-gradient(circle at 85% 0%, #E4E0FF 0, rgba(228,224,255,0) 40%),
        radial-gradient(circle at 10% 100%, #DDF3EC 0, rgba(221,243,236,0) 40%),
        #F4F3FB !important;
    min-height: 100%;
}

/* chips-only header (no ring) and the slot between header and levels */
.gs-hero-chips { padding: 12px 16px; }
.gs-hero-chips .gs-chips { justify-content: center; }
.gs-slot:empty { display: none; }
.gs-slot > * { margin: 0 !important; max-width: none !important; width: auto !important; }
/* a stand-alone header (renderHero) placed inside a game's own screen */
.gs-hero.gs-standalone { max-width: 560px; margin: 0 auto 14px; }

/* ─── instructions screen (GameSelect.renderIntro) ─────────────────────────── */
.gs-intro { max-width: 560px; gap: 14px; padding-top: 18px; }
.gs-intro-head { display: flex; align-items: center; gap: 14px; }
.gs-intro-icon {
    width: 64px; height: 64px; border-radius: 18px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 34px;
    background: color-mix(in srgb, var(--gs-accent) 12%, #fff); color: var(--gs-accent);
    border: 2px solid color-mix(in srgb, var(--gs-accent) 25%, #fff);
}
.gs-intro-icon img, .gs-intro-icon svg { width: 40px; height: 40px; object-fit: contain; }
.gs-intro-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gs-intro-titles h1 { margin: 0; font-size: 28px; font-weight: 800; line-height: 1.1; color: var(--gs-ink); }
.gs-intro-titles span { font-size: 15px; font-weight: 600; color: #4E4B57; }
.gs-intro-card {
    background: #fff; border: 2px solid #E2DDD3; border-radius: 18px; padding: 16px;
    box-shadow: 0 2px 0 #ECE7DD;
}
.gs-intro-card h2 { margin: 0 0 12px; font-size: 16px; font-weight: 800; color: var(--gs-accent); }
.gs-intro-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.gs-intro-steps li { display: flex; align-items: flex-start; gap: 12px; font-size: 16px; font-weight: 500; line-height: 1.5; color: var(--gs-ink); }
.gs-intro-num {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
    display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800;
    background: color-mix(in srgb, var(--gs-accent) 12%, #fff); color: var(--gs-accent);
}
.gs-intro-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.gs-intro-fact { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; font-weight: 600; line-height: 1.4; color: #2E2C35; }
.gs-intro-fact i { display: inline-flex; flex-shrink: 0; color: #5E5B66; margin-top: 1px; font-style: normal; }
.gs-intro-fact i svg, .gs-intro-fact i img { width: 20px; height: 20px; }
.gs-intro-emoji { font-size: 18px; line-height: 1; }
.gs-intro-note { font-size: 14px; line-height: 1.5; color: #2E2C35; }
/* the start button stays in reach while long instructions scroll (phones) */
.gs-intro-actions {
    display: flex; flex-direction: column; gap: 10px;
    position: sticky; bottom: 0; z-index: 2;
    margin: 0 -16px; padding: 12px 16px calc(14px + var(--tablet-safe-bottom, 0px));
    background: linear-gradient(to top, #F4F3FB 75%, rgba(244,243,251,0));
}
.gs-intro-start {
    height: 56px; border-radius: 16px; border: none; cursor: pointer;
    background: var(--gs-accent); color: #fff; font: 800 18px Heebo, system-ui, sans-serif;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--gs-accent) 35%, transparent);
    transition: transform .12s ease, filter .12s ease;
}
.gs-intro-start svg { width: 20px; height: 20px; }
.gs-intro-start:hover { transform: translateY(-1px); filter: brightness(1.06); }
.gs-intro-secondary {
    height: 46px; border-radius: 14px; cursor: pointer; background: #fff; color: var(--gs-ink);
    border: 2px solid #E2DDD3; font: 700 15px Heebo, system-ui, sans-serif;
}
.gs-intro-secondary:hover { border-color: var(--gs-accent); color: var(--gs-accent); }
.gs-intro-foot { text-align: center; font-size: 13px; color: #5E5B66; }
@media (max-width: 380px) { .gs-intro-facts { grid-template-columns: 1fr; } }

.gs-stage.noreplay { cursor: default; }
.gs-stage.noreplay:hover { transform: none; box-shadow: none; }

/* Subscribers-only levels (level `paid: true`, viewer locked): gold lock, tap opens the paywall pop-up */
.gs-paid-chip {
    display: inline-block; margin-inline-start: 6px; padding: 1px 8px; border-radius: 999px;
    background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; font-size: 11.5px; font-weight: 800; vertical-align: middle;
}
.gs-stage.paid { background: #FFFBEB; border-color: #FCD34D; box-shadow: none; color: #B45309; cursor: pointer; }
.gs-stage.paid .gs-stage-label { color: #92400E; }
.gs-paid { color: #B45309; }
.gs-level.paid .gs-badge { background: #FEF3C7; border-color: #FCD34D; color: #92400E; }
.gs-paywall {
    position: fixed; inset: 0; z-index: 10050; display: flex; align-items: center; justify-content: center;
    padding: 16px; background: rgba(23, 22, 30, .45);
}
.gs-paywall-card {
    width: min(360px, 100%); background: #fff; border-radius: 20px; padding: 24px 22px 20px; text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,.25); font-family: inherit;
}
.gs-paywall-icon {
    display: inline-flex; width: 52px; height: 52px; border-radius: 50%; align-items: center; justify-content: center;
    background: #FEF3C7; color: #B45309; margin-bottom: 8px;
}
.gs-paywall-icon svg { width: 26px; height: 26px; }
.gs-paywall-card h2 { margin: 0 0 6px; font-size: 20px; font-weight: 800; color: #1F1D29; }
.gs-paywall-card p { margin: 0 0 16px; font-size: 15px; line-height: 1.5; color: #4E4B57; }
.gs-paywall-actions { display: flex; flex-direction: column; gap: 8px; }
.gs-paywall-buy {
    display: block; padding: 12px; border-radius: 12px; background: #3730A3; color: #fff; font-weight: 800; font-size: 16px; text-decoration: none;
}
.gs-paywall-close {
    padding: 10px; border-radius: 12px; border: 1px solid #E2DDD3; background: #fff; color: #4E4B57; font-weight: 700; font-size: 15px; cursor: pointer;
}
