/* ============================================================================
   game-shell.css — capa, selecao de fase, HUD, vitoria, derrota, transicoes
   Conceito: "papel recortado & brinquedo" (ver DESIGN.md).
   Bordas grossas escuras, sombra dura deslocada, grao de papel, formas organicas.
   ============================================================================ */

.gs-root,
.gs-curtain,
.gs-fx {
    --gs-ink: var(--ink, #1B1235);
    --gs-ink-soft: var(--ink-soft, #3B2A6B);
    --gs-night: var(--night, #241A52);
    --gs-night-2: var(--night-2, #150F33);
    --gs-paper: var(--paper, #FFF6E9);
    --gs-mango: var(--mango, #FF8A3D);
    --gs-bubble: var(--bubble, #FF5E9C);
    --gs-lime: var(--lime, #B8E62D);
    --gs-teal: var(--teal, #2FD4C6);
    --gs-grape: var(--grape, #8B5CF6);
    --gs-sun: var(--sun, #FFD23F);
    --gs-tomato: var(--tomato, #FF4D4D);
    --gs-tint: #6C63FF;
    --gs-tint-lo: #2A2350;
    --gs-tint-hi: #A9A3FF;
    --gs-display: 'Baloo 2', 'Nunito', 'Segoe UI', system-ui, sans-serif;
    --gs-ui: 'Nunito', 'Segoe UI', system-ui, sans-serif;
    --gs-spring: cubic-bezier(.34, 1.56, .64, 1);
}

body.gs-locked { overflow: hidden; }

/* ------------------------------------------------------------- overlay base */
.gs-root {
    position: fixed;
    inset: 0;
    z-index: 9200;
    display: none;
    font-family: var(--gs-ui);
    color: var(--gs-paper);
    background:
        radial-gradient(120% 80% at 50% -10%, var(--gs-tint) 0%, transparent 62%),
        linear-gradient(180deg, var(--gs-tint-lo) 0%, var(--gs-night-2) 100%);
    overscroll-behavior: contain;
    -webkit-tap-highlight-color: transparent;
}
.gs-root.gs-open { display: block; animation: gsFade .2s ease both; }
@keyframes gsFade { from { opacity: 0 } to { opacity: 1 } }

.gs-grain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .05;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/></filter><rect width='140' height='140' filter='url(%23n)'/></svg>");
    mix-blend-mode: overlay;
}

.gs-panel {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}
.gs-scene {
    position: relative;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
}

/* blobs organicos de fundo */
.gs-blob {
    position: absolute;
    pointer-events: none;
    opacity: .30;
    filter: saturate(1.2);
}
.gs-blob-1 {
    width: 340px; height: 320px;
    top: -110px; left: -110px;
    background: var(--gs-tint-hi);
    border-radius: 62% 38% 45% 55% / 55% 48% 52% 45%;
    animation: gsBlob 16s ease-in-out infinite;
}
.gs-blob-2 {
    width: 300px; height: 300px;
    bottom: -130px; right: -120px;
    background: var(--gs-tint);
    border-radius: 44% 56% 62% 38% / 40% 60% 40% 60%;
    animation: gsBlob 21s ease-in-out infinite reverse;
    opacity: .38;
}
@keyframes gsBlob {
    0%, 100% { transform: rotate(0) scale(1) }
    50%      { transform: rotate(16deg) scale(1.08) }
}

/* ------------------------------------------------------ botao "tecla fisica" */
.gs-key {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 62px;
    padding: 0 22px;
    border: 3px solid var(--gs-ink);
    border-bottom-width: 8px;
    border-radius: 20px;
    background: linear-gradient(180deg, #FFB273 0%, var(--gs-mango) 100%);
    color: var(--gs-ink);
    font-family: var(--gs-display);
    font-weight: 800;
    font-size: 21px;
    letter-spacing: .4px;
    cursor: pointer;
    box-shadow: 0 6px 0 rgba(27, 18, 53, .28);
    transition: transform .08s ease, border-bottom-width .08s ease, box-shadow .08s ease;
    -webkit-tap-highlight-color: transparent;
}
.gs-key:active {
    transform: translateY(5px);
    border-bottom-width: 3px;
    box-shadow: 0 1px 0 rgba(27, 18, 53, .28);
}
.gs-key .gs-ico { flex: 0 0 auto; }
.gs-key-go { width: 100%; min-height: 68px; font-size: 24px; }
.gs-key-ghost {
    background: linear-gradient(180deg, #FFFDF7 0%, var(--gs-paper) 100%);
    color: var(--gs-ink);
}

.gs-icon-btn {
    width: 50px; height: 50px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--gs-ink);
    border-bottom-width: 6px;
    border-radius: 16px;
    background: linear-gradient(180deg, #FFFDF7 0%, var(--gs-paper) 100%);
    color: var(--gs-ink);
    cursor: pointer;
    transition: transform .08s ease, border-bottom-width .08s ease;
}
.gs-icon-btn:active { transform: translateY(3px); border-bottom-width: 3px; }

/* rodape fixo com as acoes */
.gs-foot {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding: 14px 18px calc(18px + env(safe-area-inset-bottom, 0));
    display: flex;
    gap: 12px;
    background: linear-gradient(180deg, transparent 0%, rgba(21, 15, 51, .82) 45%, rgba(21, 15, 51, .96) 100%);
}
.gs-foot-two .gs-key { min-width: 0; padding: 0 10px; gap: 7px; white-space: nowrap; }
.gs-foot-two .gs-key-go { flex: 1 1 64%; width: auto; font-size: 16.5px; }
.gs-foot-two .gs-key-ghost { flex: 1 1 36%; font-size: 17px; }

/* ------------------------------------------------------------- titulo/tag */
.gs-title {
    margin: 8px 0 0;
    font-family: var(--gs-display);
    font-weight: 800;
    font-size: 42px;
    line-height: 1.02;
    text-align: center;
    color: var(--gs-paper);
    transform: rotate(-1.5deg);
    text-shadow:
        3px 0 0 var(--gs-ink), -3px 0 0 var(--gs-ink),
        0 3px 0 var(--gs-ink), 0 -3px 0 var(--gs-ink),
        2px 2px 0 var(--gs-ink), -2px 2px 0 var(--gs-ink),
        2px -2px 0 var(--gs-ink), -2px -2px 0 var(--gs-ink),
        0 6px 0 var(--gs-ink-soft);
}
.gs-title-sm { font-size: 34px; }
.gs-tag {
    display: inline-block;
    margin: 0 auto;
    padding: 5px 16px;
    border: 3px solid var(--gs-ink);
    border-radius: 999px;
    background: var(--gs-sun);
    color: var(--gs-ink);
    font-weight: 800;
    font-size: 13px;
    letter-spacing: .6px;
    text-transform: uppercase;
    transform: rotate(1.6deg);
    box-shadow: 0 4px 0 var(--gs-ink-soft);
}

/* ==================================================================== CAPA */
.gs-intro-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 62px 22px 10px;
    position: relative;
    z-index: 2;
}
.gs-intro .gs-back { position: absolute; top: 14px; left: 14px; z-index: 4; }

.gs-medallion {
    position: relative;
    width: 196px; height: 196px;
    display: grid;
    place-items: center;
    animation: gsPopIn .5s var(--gs-spring) both;
}
@keyframes gsPopIn {
    from { opacity: 0; transform: scale(.86) translateY(10px) }
    to   { opacity: 1; transform: scale(1) translateY(0) }
}
.gs-med-rays {
    position: absolute;
    inset: -22px;
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg,
        rgba(255, 226, 128, .85) 0deg 10deg, transparent 10deg 20deg);
    animation: gsSpin 26s linear infinite;
    -webkit-mask-image: radial-gradient(circle, transparent 44%, #000 52%, #000 72%, transparent 86%);
    mask-image: radial-gradient(circle, transparent 44%, #000 52%, #000 72%, transparent 86%);
}
.gs-medallion::before {
    content: '';
    position: absolute;
    inset: -34px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 210, 63, .30) 0%, transparent 66%);
}
@keyframes gsSpin { to { transform: rotate(360deg) } }
.gs-med-ring {
    position: absolute;
    width: 178px; height: 178px;
    border-radius: 46% 54% 52% 48% / 50% 46% 54% 50%;
    background: var(--gs-sun);
    border: 4px solid var(--gs-ink);
    box-shadow: 0 8px 0 var(--gs-ink-soft);
    transform: rotate(-6deg);
}
.gs-med-disc {
    position: relative;
    width: 148px; height: 148px;
    display: grid;
    place-items: center;
    border-radius: 52% 48% 46% 54% / 48% 52% 48% 52%;
    background: linear-gradient(180deg, var(--gs-tint-hi) 0%, var(--gs-tint) 100%);
    border: 4px solid var(--gs-ink);
    box-shadow: inset 0 -8px 0 rgba(27, 18, 53, .18), 0 6px 0 var(--gs-ink-soft);
    transform: rotate(3deg);
}
.gs-med-emoji {
    font-size: 74px;
    line-height: 1;
    transform: rotate(-3deg);
    filter: drop-shadow(0 4px 0 rgba(27, 18, 53, .35));
}
.gs-med-disc svg { width: 84px; height: 84px; }

.gs-howto {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 340px;
    margin-top: 6px;
    padding: 12px 16px 12px 12px;
    border: 3px solid var(--gs-ink);
    border-radius: 22px;
    background: var(--gs-paper);
    color: var(--gs-ink);
    box-shadow: 0 6px 0 var(--gs-ink-soft);
    transform: rotate(-.8deg);
    animation: gsPopIn .45s var(--gs-spring) .12s both;
}
.gs-howto-text {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.28;
}
.gs-howto-speak {
    flex: 0 0 auto;
    width: 46px; height: 46px;
    display: grid;
    place-items: center;
    border: 3px solid var(--gs-ink);
    border-bottom-width: 5px;
    border-radius: 14px;
    background: var(--gs-teal);
    color: var(--gs-ink);
    cursor: pointer;
}
.gs-howto-speak:active { transform: translateY(2px); border-bottom-width: 3px; }

/* ======================================================== TRILHA DE FASES */
.gs-lv-top {
    position: sticky;
    top: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(12px + env(safe-area-inset-top, 0)) 14px 12px;
    background: linear-gradient(180deg, rgba(21, 15, 51, .95) 0%, rgba(21, 15, 51, .78) 70%, transparent 100%);
}
.gs-lv-title {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    line-height: 1.05;
}
.gs-lv-title b {
    display: block;
    font-family: var(--gs-display);
    font-weight: 800;
    font-size: 23px;
    color: var(--gs-paper);
    text-shadow: 0 3px 0 var(--gs-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gs-lv-title span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
    font-size: 13px;
    font-weight: 800;
    color: var(--gs-sun);
}
.gs-lv-title span svg { stroke: var(--gs-sun); fill: var(--gs-sun); }

.gs-track { position: relative; width: 100%; }
.gs-track-svg { position: absolute; inset: 0; pointer-events: none; }
.gs-road-edge {
    fill: none;
    stroke: rgba(255, 246, 233, .17);
    stroke-width: 34;
    stroke-linecap: round;
}
.gs-road {
    fill: none;
    stroke: #17103C;
    stroke-width: 26;
    stroke-linecap: round;
}
.gs-road-dots {
    fill: none;
    stroke: rgba(255, 246, 233, .78);
    stroke-width: 7;
    stroke-linecap: round;
    stroke-dasharray: 0.1 26;
}

.gs-node {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 74px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.gs-node-face {
    position: relative;
    width: 66px; height: 66px;
    display: grid;
    place-items: center;
    border: 4px solid var(--gs-ink);
    border-radius: 50% 48% 52% 50% / 50% 52% 48% 50%;
    box-shadow: 0 6px 0 var(--gs-ink-soft);
    transition: transform .1s ease, box-shadow .1s ease;
}
.gs-node:active .gs-node-face { transform: translateY(4px); box-shadow: 0 2px 0 var(--gs-ink-soft); }
.gs-node-num {
    font-family: var(--gs-display);
    font-weight: 800;
    font-size: 28px;
    color: var(--gs-ink);
    line-height: 1;
    transform: rotate(-3deg);
}

.gs-node-done .gs-node-face { background: linear-gradient(180deg, #E4FF7E 0%, var(--gs-lime) 100%); }
.gs-node-now  .gs-node-face { background: linear-gradient(180deg, #FFC48C 0%, var(--gs-mango) 100%); }
.gs-node-open .gs-node-face { background: linear-gradient(180deg, #FFFDF7 0%, var(--gs-paper) 100%); }
.gs-node-far  .gs-node-face { background: linear-gradient(180deg, #6E63A8 0%, #4A4080 100%); }
.gs-node-far .gs-node-num { color: rgba(255, 246, 233, .5); font-size: 20px; }
.gs-node-lock {
    position: absolute;
    top: -12px; right: -12px;
    width: 32px; height: 32px;
    display: grid;
    place-items: center;
    border: 3px solid var(--gs-ink);
    border-radius: 10px;
    background: var(--gs-paper);
    color: var(--gs-ink);
    box-shadow: 0 3px 0 var(--gs-ink-soft);
    transform: rotate(8deg);
}
.gs-node-lock svg { width: 18px; height: 18px; }

.gs-node-now .gs-node-face::after {
    content: '';
    position: absolute;
    inset: -12px;
    border: 4px solid var(--gs-sun);
    border-radius: 50%;
    opacity: .9;
    animation: gsPulse 1.5s ease-out infinite;
}
@keyframes gsPulse {
    0%   { transform: scale(.86); opacity: .95 }
    70%  { transform: scale(1.22); opacity: 0 }
    100% { transform: scale(1.22); opacity: 0 }
}
.gs-node-flag {
    position: absolute;
    top: -26px; left: 50%;
    transform: translateX(-50%) rotate(-6deg);
    width: 30px; height: 30px;
    display: grid;
    place-items: center;
    border: 3px solid var(--gs-ink);
    border-radius: 10px;
    background: var(--gs-bubble);
    color: var(--gs-paper);
    box-shadow: 0 3px 0 var(--gs-ink-soft);
    animation: gsBob 1.6s ease-in-out infinite;
}
@keyframes gsBob {
    0%, 100% { transform: translateX(-50%) translateY(0) rotate(-6deg) }
    50%      { transform: translateX(-50%) translateY(-5px) rotate(4deg) }
}
.gs-node-unlock { animation: gsUnlock .3s ease both; }
@keyframes gsUnlock {
    0%   { transform: translate(-50%, -50%) scale(1) }
    40%  { transform: translate(-50%, -50%) scale(1.18) rotate(-5deg) }
    100% { transform: translate(-50%, -50%) scale(1) }
}

.gs-node-stars { display: flex; gap: 2px; }
.gs-node-stars {
    padding: 2px 5px;
    border-radius: 999px;
    background: rgba(21, 15, 51, .55);
}
.gs-ns { display: block; line-height: 0; }
.gs-ns svg { stroke: rgba(255, 246, 233, .55); stroke-width: 2.8; fill: none; color: transparent; }
.gs-ns.on svg { stroke: var(--gs-ink, #1B1235); fill: var(--gs-sun, #FFD23F); color: var(--gs-sun, #FFD23F); }

.gs-track-end {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-5deg);
    width: 76px; height: 76px;
    display: grid;
    place-items: center;
    border: 4px solid var(--gs-ink);
    border-radius: 50% 46% 54% 48% / 48% 54% 46% 52%;
    background: linear-gradient(180deg, #FFE58A 0%, var(--gs-sun) 100%);
    color: var(--gs-ink);
    box-shadow: 0 7px 0 var(--gs-ink-soft);
}

.gs-foot-float { position: sticky; bottom: 0; }

/* ===================================================================== HUD */
.gs-hud {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 60px;
    z-index: 40;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    font-family: var(--gs-ui);
}
.gs-hud-back {
    pointer-events: auto;
    width: 44px; height: 44px;
    display: grid;
    place-items: center;
    border: 3px solid var(--ink, #1B1235);
    border-bottom-width: 5px;
    border-radius: 14px;
    background: var(--paper, #FFF6E9);
    color: var(--ink, #1B1235);
    cursor: pointer;
}
/* modo slim: o jogo ja tem .game-header, entao so a barra de progresso aparece */
.gs-hud-slim { height: var(--gs-hud-h, 56px); }
.gs-hud-slim .gs-hud-back,
.gs-hud-slim .gs-chip-level { display: none !important; }
.gs-hud-slim .gs-hud-chips {
    position: absolute;
    top: calc(var(--gs-hud-h, 56px) + 8px);
    right: 10px;
    margin: 0;
}
.gs-hud-slim .gs-hud-rail { bottom: -2px; }
.gs-hud-chips {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}
.gs-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    padding: 0 10px;
    border: 2.5px solid var(--ink, #1B1235);
    border-radius: 999px;
    background: var(--paper, #FFF6E9);
    color: var(--ink, #1B1235);
    font-weight: 800;
    font-size: 14px;
    box-shadow: 0 3px 0 rgba(27, 18, 53, .35);
}
.gs-chip svg { stroke: var(--ink, #1B1235); }
.gs-chip-score svg { fill: var(--sun, #FFD23F); color: var(--sun, #FFD23F); }
.gs-chip i { font-style: normal; opacity: .55; font-size: 12px; }
.gs-chip-lives { padding: 0 8px; gap: 2px; }
.gs-life { line-height: 0; opacity: .25; }
.gs-life svg { stroke: var(--ink, #1B1235); fill: none; }
.gs-life.on { opacity: 1; }
.gs-life.on svg { fill: var(--tomato, #FF4D4D); }

.gs-hud-rail {
    position: absolute;
    left: 12px; right: 12px; bottom: 2px;
    height: 6px;
    border-radius: 999px;
    background: rgba(27, 18, 53, .22);
    overflow: hidden;
}
.gs-hud-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--lime, #B8E62D), var(--sun, #FFD23F));
    transition: width .4s var(--gs-spring, cubic-bezier(.34, 1.56, .64, 1));
}
.gs-pop-once { animation: gsChipPop .3s var(--gs-spring, ease) both; }
@keyframes gsChipPop {
    0% { transform: scale(1) } 45% { transform: scale(1.18) } 100% { transform: scale(1) }
}

/* ================================================================= VITORIA */
#victory-screen .victory-content,
#victory-screen .gs-vic {
    position: relative;
    z-index: 2;
}
#victory-screen {
    background:
        radial-gradient(120% 78% at 50% 0%, #3A2E7A 0%, transparent 60%),
        linear-gradient(180deg, var(--night, #241A52) 0%, var(--night-2, #150F33) 100%) !important;
}
#victory-screen .gs-vic-rays {
    position: absolute;
    top: -30%; left: 50%;
    width: 150vmax; height: 150vmax;
    transform: translateX(-50%);
    background: repeating-conic-gradient(from 0deg,
        rgba(255, 210, 63, .075) 0deg 8deg, transparent 8deg 16deg);
    animation: gsSpin 42s linear infinite;
    pointer-events: none;
    z-index: 0;
    -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 12%, transparent 46%);
    mask-image: radial-gradient(circle at 50% 40%, #000 12%, transparent 46%);
}
#victory-screen .gs-vic-card {
    position: relative;
    z-index: 4;
    width: min(340px, calc(100vw - 36px));
    margin: 0 auto;
    padding: 18px 18px 26px;
    border: 4px solid var(--ink, #1B1235);
    border-radius: 30px;
    background: linear-gradient(180deg, #FFFDF7 0%, var(--paper, #FFF6E9) 100%);
    box-shadow: 0 10px 0 var(--ink-soft, #3B2A6B);
    transform: rotate(-1deg);
    animation: gsCardIn .42s cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes gsCardIn {
    from { opacity: 0; transform: rotate(-1deg) scale(.9) translateY(18px) }
    to   { opacity: 1; transform: rotate(-1deg) scale(1) translateY(0) }
}

#victory-screen .victory-stars-container {
    display: flex !important;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    margin: -46px 0 2px !important;
    min-height: 92px;
    padding: 0 !important;
}
#victory-screen .victory-star {
    position: relative;
    width: 68px; height: 68px;
    display: grid;
    place-items: center;
    opacity: 1 !important;
    font-size: 0 !important;
    animation: none !important;
    transform: scale(0);
}
#victory-screen .victory-star.s2 { width: 82px; height: 82px; margin-bottom: 10px; }
#victory-screen .victory-star .gs-star-svg {
    width: 100%; height: 100%;
    stroke: var(--ink, #1B1235);
    stroke-width: 2;
    /* color TAMBEM: o path do icone 'star' nasce com fill="currentColor", e so
       o fill no <svg> nao o alcanca - a estrela ganha saia cor de tinta. */
    color: #6A5F9E;
    fill: #6A5F9E;
    filter: drop-shadow(0 5px 0 rgba(27, 18, 53, .5));
}
#victory-screen .victory-star.earned .gs-star-svg { fill: var(--sun, #FFD23F); color: var(--sun, #FFD23F); }
#victory-screen .victory-star .gs-star-glow {
    position: absolute;
    inset: -14%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 210, 63, .7) 0%, transparent 68%);
    opacity: 0;
}
#victory-screen .victory-star.earned.gs-star-in .gs-star-glow { animation: gsGlow .7s ease-out both; }
@keyframes gsGlow { 0% { opacity: 0; transform: scale(.5) } 35% { opacity: 1 } 100% { opacity: 0; transform: scale(1.5) } }
#victory-screen .victory-star.gs-star-wait { transform: scale(0); }
#victory-screen .victory-star.gs-star-in { animation: gsStarDrop .52s cubic-bezier(.34, 1.56, .64, 1) both !important; }
@keyframes gsStarDrop {
    0%   { transform: scale(0) translateY(-40px) rotate(-40deg) }
    60%  { transform: scale(1.28) translateY(0) rotate(8deg) }
    100% { transform: scale(1) translateY(0) rotate(0) }
}
#victory-screen .victory-star.gs-trophy { width: 108px; height: 108px; }
#victory-screen .victory-star.gs-trophy .gs-star-svg { fill: none; stroke-width: 2.2; stroke: var(--ink, #1B1235); }
#victory-screen.gs-vic-complete .victory-star.gs-trophy .gs-star-svg { fill: var(--sun, #FFD23F); color: var(--sun, #FFD23F); }

#victory-screen .victory-title {
    margin: 4px 0 2px !important;
    font-family: 'Baloo 2', 'Nunito', system-ui, sans-serif;
    font-weight: 800;
    font-size: 36px !important;
    line-height: 1.05;
    text-align: center;
    color: var(--ink, #1B1235) !important;
    text-shadow: none !important;
    transform: rotate(-1.2deg);
    -webkit-text-fill-color: currentColor;
    background: none !important;
}
#victory-screen .victory-text {
    margin: 0 0 10px !important;
    text-align: center;
    font-size: 17px !important;
    font-weight: 700;
    color: rgba(27, 18, 53, .78) !important;
}
#victory-screen #gs-vic-level {
    display: block;
    text-align: center;
    margin: 0 auto 8px;
    padding: 3px 12px;
    width: fit-content;
    border: 2.5px solid var(--ink, #1B1235);
    border-radius: 999px;
    background: var(--teal, #2FD4C6);
    color: var(--ink, #1B1235);
    font-weight: 800;
    font-size: 12px;
    letter-spacing: .5px;
    text-transform: uppercase;
    transform: rotate(1.2deg);
}
#victory-screen #gs-vic-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 0 10px;
    font-family: 'Baloo 2', 'Nunito', system-ui, sans-serif;
    font-weight: 800;
    font-size: 30px;
    font-variant-numeric: tabular-nums;
    color: var(--ink, #1B1235);
}
#victory-screen #gs-vic-score svg { stroke: var(--ink, #1B1235); fill: var(--sun, #FFD23F); }

#victory-screen .victory-reward {
    text-align: center;
    font-weight: 800;
    font-size: 16px;
    color: var(--ink, #1B1235) !important;
}
#victory-screen .victory-goal {
    margin-top: 10px;
    padding: 8px 10px;
    border: 2.5px dashed rgba(27, 18, 53, .35);
    border-radius: 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink, #1B1235) !important;
}
#victory-screen .victory-goal-text,
#victory-screen .victory-goal strong {
    color: var(--ink, #1B1235) !important;
    text-shadow: none !important;
}
#victory-screen .victory-goal-bar {
    margin-top: 6px;
    height: 8px;
    border-radius: 999px;
    background: rgba(27, 18, 53, .16);
    overflow: hidden;
}
#victory-screen .victory-goal-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--lime, #B8E62D), var(--sun, #FFD23F));
}
#victory-screen .adaptive-badge.visible {
    display: inline-flex;
    margin: 10px auto 0;
}

#victory-screen .victory-mascot-wrapper {
    position: absolute;
    z-index: 6;
    right: 6px;
    bottom: -28px;
    width: 74px;
    height: 74px;
    display: flex !important;
    align-items: flex-end;
    justify-content: center;
    margin: 0;
    transform: rotate(-9deg);
    pointer-events: none;
    filter: drop-shadow(0 5px 0 rgba(27, 18, 53, .45));
}
#victory-screen .victory-mascot { font-size: 60px; line-height: 1; display: inline-block; }
#victory-screen .victory-mascot svg,
#victory-screen .victory-mascot img,
#victory-screen .victory-mascot canvas { width: 72px !important; height: 72px !important; }
.gs-cheer { animation: gsCheer .8s ease-in-out 2 both; }
@keyframes gsCheer {
    0%, 100% { transform: rotate(-9deg) translateY(0) }
    25%      { transform: rotate(4deg) translateY(-12px) }
    75%      { transform: rotate(-17deg) translateY(-8px) }
}

#victory-screen .victory-buttons {
    position: relative;
    z-index: 3;
    display: flex !important;
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
    width: min(340px, calc(100vw - 36px)) !important;
    max-width: none !important;
    margin: 22px auto 0 !important;
    padding: 0 0 calc(12px + env(safe-area-inset-bottom, 0)) !important;
}
#victory-screen .gs-vic-row { display: flex; gap: 10px; width: 100%; }
#victory-screen .gs-vic-row .victory-btn {
    flex: 1 1 0;
    width: auto !important;
    min-width: 0;
    font-size: 17px;
    gap: 6px;
    padding: 0 8px;
    white-space: nowrap;
}
#victory-screen .victory-btn.next-btn { width: 100% !important; }
#victory-screen .victory-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 60px;
    padding: 0 16px;
    border: 3px solid var(--ink, #1B1235) !important;
    border-bottom-width: 8px !important;
    border-radius: 20px !important;
    font-family: 'Baloo 2', 'Nunito', system-ui, sans-serif;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: .4px;
    color: var(--ink, #1B1235) !important;
    box-shadow: 0 6px 0 rgba(27, 18, 53, .3) !important;
    transition: transform .08s ease, border-bottom-width .08s ease;
    text-shadow: none !important;
}
#victory-screen .victory-btn:active {
    transform: translateY(5px);
    border-bottom-width: 3px !important;
    box-shadow: 0 1px 0 rgba(27, 18, 53, .3) !important;
}
#victory-screen .victory-btn.next-btn {
    background: linear-gradient(180deg, #D2F76A 0%, var(--lime, #B8E62D) 100%) !important;
    min-height: 68px;
    font-size: 23px;
}
#victory-screen .victory-btn.retry-btn {
    background: linear-gradient(180deg, #FFB273 0%, var(--mango, #FF8A3D) 100%) !important;
}
#victory-screen .victory-btn.menu-btn {
    background: linear-gradient(180deg, #FFFDF7 0%, var(--paper, #FFF6E9) 100%) !important;
}
#victory-screen .victory-btn svg { stroke: var(--ink, #1B1235); flex: 0 0 auto; }
#victory-screen .victory-btn.next-btn svg { fill: var(--ink, #1B1235); }

/* ================================================================= DERROTA */
.gs-defeat-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 24px 10px;
    position: relative;
    z-index: 2;
}
.gs-defeat-mascot {
    position: relative;
    width: 148px; height: 148px;
    display: grid;
    place-items: center;
    border: 4px solid var(--gs-ink);
    border-radius: 50% 46% 54% 50% / 48% 52% 48% 52%;
    background: linear-gradient(180deg, var(--gs-tint-hi) 0%, var(--gs-tint) 100%);
    box-shadow: 0 8px 0 var(--gs-ink-soft);
    animation: gsPopIn .45s var(--gs-spring) both;
}
.gs-defeat-face {
    font-size: 74px;
    line-height: 1;
    animation: gsSway 2.4s ease-in-out infinite;
}
@keyframes gsSway {
    0%, 100% { transform: rotate(-5deg) }
    50%      { transform: rotate(5deg) }
}
.gs-defeat-heart {
    position: absolute;
    right: -10px; bottom: 4px;
    width: 44px; height: 44px;
    display: grid;
    place-items: center;
    border: 3px solid var(--gs-ink);
    border-radius: 14px;
    background: var(--gs-bubble);
    color: var(--gs-paper);
    box-shadow: 0 4px 0 var(--gs-ink-soft);
    transform: rotate(9deg);
    animation: gsBeat 1.4s ease-in-out infinite;
}
.gs-defeat-heart svg { fill: var(--gs-paper); }
@keyframes gsBeat {
    0%, 100% { transform: rotate(9deg) scale(1) }
    45%      { transform: rotate(9deg) scale(1.14) }
}
.gs-defeat-text {
    margin: 0;
    max-width: 320px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.32;
    color: rgba(255, 246, 233, .92);
}
.gs-defeat-score {
    margin-top: 4px;
    padding: 6px 16px;
    border: 3px solid var(--gs-ink);
    border-radius: 999px;
    background: var(--gs-paper);
    color: var(--gs-ink);
    font-weight: 800;
    box-shadow: 0 4px 0 var(--gs-ink-soft);
}

/* =============================================================== CORTINA */
.gs-curtain {
    position: fixed;
    inset: 0;
    z-index: 9600;
    display: none;
    pointer-events: none;
}
.gs-curtain.gs-cur-on { display: block; pointer-events: auto; }
.gs-cur {
    position: absolute;
    left: -2%;
    width: 104%;
    height: 56%;
    background: linear-gradient(180deg, var(--night, #241A52) 0%, var(--night-2, #150F33) 100%);
}
.gs-cur-a {
    top: 0;
    transform: translateY(-102%);
    clip-path: polygon(0 0, 100% 0, 100% 92%, 92% 100%, 83% 92%, 75% 100%, 66% 92%, 58% 100%, 50% 92%, 41% 100%, 33% 92%, 25% 100%, 16% 92%, 8% 100%, 0 92%);
}
.gs-cur-b {
    bottom: 0;
    transform: translateY(102%);
    clip-path: polygon(0 8%, 8% 0, 16% 8%, 25% 0, 33% 8%, 41% 0, 50% 8%, 58% 0, 66% 8%, 75% 0, 83% 8%, 92% 0, 100% 8%, 100% 100%, 0 100%);
}
.gs-cur-badge {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 84px; height: 84px;
    display: grid;
    place-items: center;
    border: 4px solid var(--ink, #1B1235);
    border-radius: 50% 46% 54% 48% / 48% 54% 46% 52%;
    background: linear-gradient(180deg, #FFE58A 0%, var(--sun, #FFD23F) 100%);
    color: var(--ink, #1B1235);
    box-shadow: 0 7px 0 var(--ink-soft, #3B2A6B);
    opacity: 0;
}
.gs-cur-badge svg { fill: var(--ink, #1B1235); color: var(--ink, #1B1235); }
.gs-cur-close .gs-cur-a { animation: gsCurInA .33s cubic-bezier(.4, 0, .2, 1) forwards; }
.gs-cur-close .gs-cur-b { animation: gsCurInB .33s cubic-bezier(.4, 0, .2, 1) forwards; }
.gs-cur-close .gs-cur-badge { animation: gsBadgeIn .42s cubic-bezier(.34, 1.56, .64, 1) .12s forwards; }
.gs-cur-open .gs-cur-a { animation: gsCurOutA .38s cubic-bezier(.4, 0, .2, 1) forwards; }
.gs-cur-open .gs-cur-b { animation: gsCurOutB .38s cubic-bezier(.4, 0, .2, 1) forwards; }
.gs-cur-open .gs-cur-badge { animation: gsBadgeOut .22s ease forwards; }
@keyframes gsCurInA  { from { transform: translateY(-102%) } to { transform: translateY(0) } }
@keyframes gsCurInB  { from { transform: translateY(102%) }  to { transform: translateY(0) } }
@keyframes gsCurOutA { from { transform: translateY(0) } to { transform: translateY(-102%) } }
@keyframes gsCurOutB { from { transform: translateY(0) } to { transform: translateY(102%) } }
@keyframes gsBadgeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0) rotate(-90deg) }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0) }
}
@keyframes gsBadgeOut {
    from { opacity: 1; transform: translate(-50%, -50%) scale(1) }
    to   { opacity: 0; transform: translate(-50%, -50%) scale(.4) }
}

/* ============================================================== PARTICULAS */
.gs-fx {
    position: fixed;
    inset: 0;
    z-index: 9800;
    pointer-events: none;
    overflow: hidden;
}
.gs-spark {
    position: absolute;
    width: 10px; height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 3px;
    border: 2px solid rgba(27, 18, 53, .5);
    animation: gsSpark .72s cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes gsSpark {
    0%   { transform: translate(0, 0) scale(1) rotate(0); opacity: 1 }
    100% { transform: translate(var(--dx, 0), var(--dy, 0)) scale(.2) rotate(220deg); opacity: 0 }
}

/* ======================================================= telas mais altas */
@media (min-height: 720px) {
    .gs-medallion { width: 214px; height: 214px; }
    .gs-med-ring { width: 194px; height: 194px; }
    .gs-med-disc { width: 162px; height: 162px; }
    .gs-med-emoji { font-size: 82px; }
    .gs-title { font-size: 46px; }
}

/* ================================================== movimento reduzido */
@media (prefers-reduced-motion: reduce) {
    .gs-root *,
    .gs-curtain *,
    .gs-fx *,
    #victory-screen .victory-star,
    #victory-screen .gs-vic-card,
    #victory-screen .gs-vic-rays {
        animation: none !important;
        transition: none !important;
    }
    #victory-screen .victory-star { transform: scale(1) !important; }
    .gs-node-unlock { transform: translate(-50%, -50%) !important; }
}

/* Capa ilustrada do jogo (images/capas/<id>.webp), quando existir.
   Sem manifesto, nada e' requisitado e o medalhao segue com o SVG. */
.gs-med-cover {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}
.gs-med-disc.gs-med-nocover { background: var(--gs-med-bg, rgba(255,255,255,.14)); }
