/* ============================================================
   Spider Count — kids' counting game
   Self-contained; relies only on the site's theme CSS vars.
   ============================================================ */

.sc-page, .sc-landing {
    --sc-plain: #6b7280;
    --sc-blue: #3b82f6;
    --sc-red: #ef4444;
    --sc-green: #22c55e;
    --sc-gold: #f59e0b;
    --sc-accent: #8b5cf6;
}
.sc-page {
    max-width: 720px;
    margin: 0 auto;
    padding: calc(80px + 1.5rem) 1rem 3rem;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ---------- v2 landing: .sc-landing is layout-neutral; the .v2 sections own
   layout. It only carries the game's colour vars. ---------- */
.sc-intro, .sc-result { text-align: center; }

/* Game "device" card that sits in the v2 hero's right column */
.sc-device {
    background: var(--bg-secondary, #faf7f2);
    border: 1px solid var(--rule, rgba(10,10,10,.12));
    border-radius: 22px;
    padding: 1.25rem 1.2rem 1.5rem;
    box-shadow: 8px 8px 0 var(--ink, #0a0a0a);
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    color: var(--text-primary, #1a1a1a);
}
.sc-idle { text-align: center; padding: 1.5rem 0.5rem; }
.sc-idle-spider { font-size: 4rem; line-height: 1; margin-bottom: 0.75rem; }
.sc-idle-copy { font-size: 1rem; color: var(--muted, #52524f); margin: 0 0 1.25rem; line-height: 1.5; }

/* Leaderboard panel (centred inside its v2 section) */
.sc-board {
    max-width: 520px;
    margin: 0 auto;
    background: var(--cream, #fff);
    border: 1px solid var(--rule, #e5e7eb);
    border-radius: 1.25rem;
    padding: 1.1rem 1.2rem 1.25rem;
}
.sc-lb { list-style: none; margin: 0; padding: 0; }
.sc-lb-row {
    display: grid;
    grid-template-columns: 2rem 1fr auto;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.5rem;
    border-radius: 0.6rem;
    font-weight: 700;
}
.sc-lb-row + .sc-lb-row { border-top: 1px solid var(--border-color, #eee); }
.sc-lb-rank { font-size: 1.05rem; text-align: center; }
.sc-lb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-lb-name em { color: var(--sc-accent); font-style: normal; font-weight: 800; }
.sc-lb-score { font-size: 1.15rem; font-weight: 900; color: var(--sc-accent); }
.sc-lb-row.is-bot { color: var(--text-secondary, #666); }
.sc-lb-row.is-bot .sc-lb-score { color: var(--text-secondary, #888); }
.sc-lb-row.is-you {
    background: rgba(139, 92, 246, 0.12);
    box-shadow: inset 0 0 0 1.5px rgba(139, 92, 246, 0.35);
    color: var(--text-primary, #111);
}
.sc-board-note {
    margin: 0.9rem 0 0; font-size: 0.8rem; line-height: 1.4;
    color: var(--text-secondary, #666);
}

/* Made-the-board / missed celebration blocks (game over) */
.sc-made { text-align: center; }
.sc-made-burst { font-size: 2.4rem; animation: sc-pop 0.4s ease; }
.sc-made-title { font-size: 1.3rem; font-weight: 900; margin: 0.2rem 0 0.4rem; color: var(--sc-gold); }
.sc-made-sub { font-size: 0.98rem; color: var(--text-secondary, #555); margin: 0 0 1rem; }
.sc-made-fine { font-size: 0.78rem; color: var(--text-tertiary, #999); margin: 0.6rem 0 0; }
.sc-missed { text-align: center; }
.sc-missed-copy { font-size: 0.98rem; color: var(--text-secondary, #555); margin: 0 0 0.6rem; }
.sc-missed-link { font-size: 0.9rem; font-weight: 800; color: var(--sc-accent); text-decoration: none; }

/* Register CTA band (free account, not pricing) */
.sc-cta-band {
    text-align: center;
    background: linear-gradient(135deg, rgba(139,92,246,0.10), rgba(59,130,246,0.10));
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 1.5rem;
    padding: 2rem 1.25rem;
    margin: 2.5rem 0 1rem;
}
.sc-cta-band h2 { font-size: 1.5rem; font-weight: 900; margin: 0 0 0.4rem; }
.sc-cta-band p { color: var(--text-secondary, #555); margin: 0 0 1.1rem; }

@media (max-width: 820px) {
    .sc-hero-grid { grid-template-columns: 1fr; }
    .sc-board { position: static; }
}

/* Screens — only one visible at a time */
.sc-screen { display: none; }
.sc-screen.is-active { display: block; animation: sc-fade 0.25s ease; }
@keyframes sc-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Intro / level select ---------- */
.sc-intro-inner { text-align: center; }

.sc-badge {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--sc-accent);
    margin-bottom: 1rem;
}

.sc-title {
    font-size: clamp(2.2rem, 9vw, 3.4rem);
    font-weight: 900;
    margin: 0 0 0.4rem;
    color: var(--text-primary, #111);
    letter-spacing: -0.02em;
}
.sc-title-accent {
    background: linear-gradient(135deg, var(--sc-accent), var(--sc-blue));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sc-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary, #555);
    max-width: 30rem;
    margin: 0 auto 1.75rem;
    line-height: 1.5;
}

.sc-levels {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
    max-width: 30rem;
    margin: 0 auto;
}

.sc-level-card {
    position: relative;
    padding: 1rem 0.9rem;
    background: var(--bg-secondary, #f7f7f9);
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 1rem;
    text-align: left;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
    font: inherit;
    color: inherit;
}
.sc-level-card:hover:not(.is-locked) {
    transform: translateY(-2px);
    border-color: var(--sc-accent);
    box-shadow: 0 6px 18px rgba(139, 92, 246, 0.18);
}
.sc-level-card.is-locked { cursor: pointer; opacity: 0.72; }
.sc-level-card.is-locked:hover { border-color: var(--sc-gold); }

.sc-level-num {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sc-accent);
}
.sc-level-card.is-locked .sc-level-num { color: var(--sc-gold); }

.sc-level-name {
    display: block;
    font-size: 1.02rem;
    font-weight: 800;
    margin-top: 0.15rem;
    color: var(--text-primary, #111);
}
.sc-level-lock {
    position: absolute;
    top: 0.7rem;
    right: 0.8rem;
    font-size: 1.1rem;
}

/* ---------- Play stage ---------- */
.sc-play-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.sc-quit, .sc-progress {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary, #555);
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}
.sc-progress { color: var(--sc-accent); }

.sc-rulecard {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    justify-content: center;
    flex: 1;
}
.sc-rulechip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.55rem;
    background: var(--bg-secondary, #f7f7f9);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 2rem;
    font-size: 0.78rem;
    font-weight: 700;
}
.sc-rulechip .sc-dot {
    width: 0.85rem; height: 0.85rem; border-radius: 50%;
}
.sc-rulechip.is-skip { opacity: 0.75; }
.sc-rule-emoji { font-size: 1.1rem; line-height: 1; }
.sc-rule-worth { color: var(--sc-accent); font-weight: 900; }
.sc-rule-skip {
    color: var(--sc-red); font-weight: 800; text-transform: uppercase;
    font-size: 0.68rem; letter-spacing: 0.03em;
}

/* ---------- Countdown spinner (get-ready reveal) ---------- */
.sc-spinner {
    position: relative;
    width: 110px; height: 110px;
    display: flex; align-items: center; justify-content: center;
}
.sc-spinner[hidden] { display: none; }
.sc-spinner-ring {
    position: absolute; inset: 0;
    border-radius: 50%;
    background: conic-gradient(var(--sc-accent) 0turn, transparent 0.7turn, var(--sc-accent) 1turn);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 10px), #000 calc(100% - 9px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 10px), #000 calc(100% - 9px));
    opacity: 0.85;
}
.sc-spinner.is-spinning .sc-spinner-ring { animation: sc-spin 0.6s linear infinite; }
@keyframes sc-spin { to { transform: rotate(1turn); } }
.sc-spinner-num {
    font-size: 3rem; font-weight: 900; color: var(--sc-accent);
    line-height: 1; z-index: 1;
}

/* Stage where a critter appears */
/* Circular game: timing ring around a tappable centre image */
.sc-stage {
    position: relative;
    width: min(78vw, 320px);
    aspect-ratio: 1 / 1;
    margin: 0.5rem auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    background: radial-gradient(circle at 50% 42%, rgba(139,92,246,0.10), rgba(139,92,246,0.02) 68%);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: transform 0.08s ease;
}
.sc-stage.is-live:active { transform: scale(0.97); }

.sc-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.sc-ring-track { fill: none; stroke: var(--border-color, #e5e7eb); stroke-width: 5; }
.sc-ring-fill {
    fill: none;
    stroke: var(--sc-accent);
    stroke-width: 6;
    stroke-linecap: round;
    transform: rotate(-90deg);           /* start depleting from the top */
    transform-origin: 50% 50%;
    opacity: 0;
}

.sc-critter { font-size: 6rem; line-height: 1; z-index: 1; pointer-events: none; }
.sc-critter.sc-pop { animation: sc-pop 0.24s ease; }
.sc-critter.sc-modified { filter: drop-shadow(0 0 14px rgba(245, 158, 11, 0.85)); }
@keyframes sc-pop { 0% { transform: scale(0.3); opacity: 0; } 60% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }

/* Armed-rule reminder chip (a modifier is waiting for the next spider) */
.sc-armed {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    padding: 0.3rem 0.7rem;
    background: var(--sc-gold);
    color: #4a2e00;
    font-size: 0.8rem;
    font-weight: 800;
    border-radius: 2rem;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}
.sc-armed[hidden] { display: none; }

/* Counter primitive */
.sc-counter { text-align: center; }
.sc-count-value {
    font-size: 3.2rem; font-weight: 900; line-height: 1;
    color: var(--text-primary, #111);
}
.sc-count-label {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-secondary, #777); margin-bottom: 0.9rem;
}
.sc-tap {
    width: 100%; max-width: 22rem;
    padding: 1.25rem;
    font-size: 1.5rem; font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, var(--sc-accent), #7c3aed);
    border: none; border-radius: 1.25rem;
    cursor: pointer;
    box-shadow: 0 8px 0 #6d28d9;
    transition: transform 0.06s ease, box-shadow 0.06s ease;
    display: block; margin: 0 auto;
}
.sc-tap:active { transform: translateY(6px); box-shadow: 0 2px 0 #6d28d9; }
.sc-tap:disabled {
    opacity: 0.45;
    box-shadow: 0 8px 0 #6d28d9;
    cursor: default;
    filter: grayscale(0.4);
}
.sc-tap.is-armed { animation: sc-arm 0.9s ease-in-out infinite; }
@keyframes sc-arm { 0%,100% { box-shadow: 0 8px 0 #6d28d9; } 50% { box-shadow: 0 8px 22px rgba(139,92,246,0.55); } }
.sc-critter[hidden] { display: none; }
.sc-critter.sc-correct { filter: drop-shadow(0 0 18px rgba(34, 197, 94, 0.9)); }
.sc-critter.sc-wrong { filter: drop-shadow(0 0 18px rgba(239, 68, 68, 0.9)); animation: sc-shake 0.32s ease; }
@keyframes sc-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* ---------- How-to (start screen) ---------- */
.sc-howto {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem;
    max-width: 32rem; margin: 0 auto 1.75rem; text-align: left;
}
.sc-howto-item {
    display: flex; align-items: center; gap: 0.55rem;
    padding: 0.7rem 0.85rem;
    background: var(--bg-secondary, #f7f7f9);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0.75rem;
    font-size: 0.9rem; font-weight: 600;
    color: var(--text-secondary, #444);
}
.sc-howto-item span { font-size: 1.3rem; }
@media (max-width: 480px) { .sc-howto { grid-template-columns: 1fr; } }

/* ---------- HUD ---------- */
.sc-hud {
    display: flex; align-items: center; gap: 0.75rem;
    margin-bottom: 0.9rem;
}
.sc-quit {
    font-size: 1.1rem; font-weight: 800; line-height: 1;
    width: 2rem; height: 2rem; border-radius: 50%;
    background: var(--bg-secondary, #f1f1f4); border: none; cursor: pointer;
    color: var(--text-secondary, #666); flex-shrink: 0;
}
.sc-hud-stat { display: flex; flex-direction: column; align-items: center; }
.sc-hud-label {
    font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-secondary, #888); font-weight: 700;
}
.sc-hud-value { font-size: 1.4rem; font-weight: 900; color: var(--text-primary, #111); line-height: 1; }
.sc-hud-lives { margin-left: auto; font-size: 1.15rem; letter-spacing: 0.1rem; }

.sc-count-these {
    font-size: 0.68rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-secondary, #888); align-self: center;
}

/* ---------- Rule + stage pops ---------- */
.sc-rulepop {
    position: absolute; inset: 0; z-index: 2;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.5rem; padding: 1rem; text-align: center;
    background: rgba(239, 68, 68, 0.08);
}
.sc-rulepop[hidden] { display: none; }
.sc-rulepop-icon { font-size: 2.6rem; line-height: 1; }
.sc-rulepop-text { font-size: 1.35rem; font-weight: 900; color: var(--sc-red); max-width: 16rem; }

.sc-stagepop {
    position: absolute; inset: 0; z-index: 3;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.4rem; font-weight: 900; color: var(--sc-gold);
    pointer-events: none;
    text-shadow: 0 2px 12px rgba(245, 158, 11, 0.5);
}
.sc-stagepop[hidden] { display: none; }

/* ---------- Game over + save gate ---------- */
.sc-gameover-emoji { font-size: 3.5rem; }
.sc-finalscore { margin: 0.5rem 0 1.25rem; }
.sc-finalscore-num { font-size: 3.5rem; font-weight: 900; line-height: 1; color: var(--sc-accent); }
.sc-finalscore-label { font-size: 0.95rem; color: var(--text-secondary, #555); margin-top: 0.25rem; }
.sc-finalscore-label strong { color: var(--text-primary, #111); }

.sc-save {
    max-width: 24rem; margin: 0 auto 1.5rem;
    background: var(--bg-secondary, #f7f7f9);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 1rem; padding: 1.1rem;
}
.sc-save-copy { font-size: 0.9rem; color: var(--text-secondary, #555); margin: 0.4rem 0 0.9rem; line-height: 1.45; }
.sc-save-best { margin-top: 0.7rem; font-weight: 800; color: var(--sc-green); }
.sc-save-best[hidden] { display: none; }

.sc-btn-gold { color: #4a2e00; background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.sc-btn-gold:disabled { opacity: 0.7; cursor: default; }
.sc-tap-plus { display: block; }
.sc-tap-hint { display: block; font-size: 0.75rem; font-weight: 600; opacity: 0.85; margin-top: 0.15rem; }

.sc-next {
    margin-top: 0.9rem;
    padding: 0.7rem 1.4rem;
    font-size: 1rem; font-weight: 800;
    color: var(--sc-accent);
    background: none;
    border: 2px solid var(--sc-accent);
    border-radius: 0.75rem;
    cursor: pointer;
}
.sc-next[hidden] { display: none; }

/* ---------- Result ---------- */
.sc-result-inner { text-align: center; }
.sc-stars { font-size: 2.6rem; letter-spacing: 0.2rem; color: var(--sc-gold); margin-bottom: 0.5rem; }
.sc-stars .sc-star-off { color: var(--border-color, #d1d5db); }
.sc-result-title { font-size: 1.6rem; font-weight: 900; margin: 0 0 1.25rem; }
.sc-tally {
    max-width: 20rem; margin: 0 auto 1.5rem;
    background: var(--bg-secondary, #f7f7f9);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 1rem; padding: 0.5rem 1rem;
}
.sc-tally-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.6rem 0; font-size: 1rem;
}
.sc-tally-row + .sc-tally-row { border-top: 1px solid var(--border-color, #e5e7eb); }
.sc-tally-row strong { font-size: 1.3rem; }

.sc-result-actions { display: flex; flex-direction: column; gap: 0.6rem; max-width: 20rem; margin: 0 auto; }

/* ---------- Buttons ---------- */
.sc-btn {
    padding: 0.85rem 1.4rem;
    font-size: 1.05rem; font-weight: 800;
    border-radius: 0.85rem; cursor: pointer; border: none;
    font-family: inherit;
    text-decoration: none; display: inline-block; text-align: center;
}
.sc-btn-primary { color: #fff; background: linear-gradient(135deg, var(--sc-accent), #7c3aed); }
.sc-btn-ghost { color: var(--sc-accent); background: none; border: 2px solid var(--border-color, #e5e7eb); }
.sc-btn-lg { font-size: 1.2rem; padding: 1rem 1.6rem; }

/* ---------- Wall ---------- */
.sc-wall-inner { text-align: center; max-width: 26rem; margin: 0 auto; }
.sc-wall-lock { font-size: 3.5rem; }
.sc-wall-title { font-size: 1.6rem; font-weight: 900; margin: 0.5rem 0; }
.sc-wall-copy { color: var(--text-secondary, #555); font-size: 1.05rem; line-height: 1.5; margin-bottom: 1.25rem; }
.sc-wall-grownup {
    font-size: 0.9rem; font-weight: 800; color: var(--sc-gold);
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem;
}
.sc-wall .sc-btn { display: block; margin: 0 auto 0.7rem; max-width: 22rem; }

@media (max-width: 480px) {
    .sc-critter { font-size: 5rem; }
    .sc-levels { grid-template-columns: 1fr; }
}
