/* ==========================================================================
   DESAFIO AMBIENTAL — JOGO DO MEIO AMBIENTE
   Tema claro, natural e sustentável · www.horadaseguranca.com
   ========================================================================== */

:root {
    /* --- Paleta natural (ambiente claro) --- */
    --sky-top:      #dff1fb;
    --sky-bottom:   #eefaf0;
    --bg-card:      #ffffff;
    --bg-soft:      #f4fbf5;
    --bg-cream:     #fefdf7;

    --leaf:         #2f9e51;
    --leaf-dark:    #1f7a3c;
    --leaf-light:   #e6f7ea;
    --leaf-glow:    rgba(47, 158, 81, 0.22);

    --water:        #0e9ec9;
    --water-dark:   #0a7ba0;
    --water-light:  #e2f6fc;

    --earth:        #9a6b34;
    --earth-light:  #fdf5e9;

    --sun:          #f0a91c;
    --sun-light:    #fff7e4;

    --alert:        #dc2626;
    --alert-light:  #fef2f2;

    --text-primary:   #14311f;
    --text-secondary: #40614b;
    --text-muted:     #6b8574;

    --line: #d9ebdd;

    /* --- Sombras suaves --- */
    --shadow-sm: 0 2px 8px rgba(20, 49, 31, 0.06);
    --shadow-md: 0 6px 18px rgba(20, 49, 31, 0.09);
    --shadow-lg: 0 14px 34px rgba(20, 49, 31, 0.13);

    --radius:    16px;
    --radius-lg: 22px;

    --font-heading: 'Outfit', -apple-system, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, sans-serif;

    --transition-fast: 0.18s ease;
    --transition-bounce: 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: clamp(14px, 0.5vw + 12.6px, 17px); }

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background: linear-gradient(180deg, var(--sky-top) 0%, #eaf6ef 45%, var(--sky-bottom) 100%);
    background-attachment: fixed;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--leaf-dark); text-decoration: none; }

.hidden { display: none !important; }


/* ==========================================================================
   CENÁRIO AMBIENTAL ANIMADO
   ========================================================================== */

.eco-scene {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
}

/* Clareia o cenário para manter o ambiente leve e o texto legível */
.eco-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.62) 40%, rgba(255,255,255,0.78) 100%);
}

.eco-sun {
    position: absolute;
    top: 6%;
    right: 8%;
    width: clamp(80px, 9vw, 140px);
    height: clamp(80px, 9vw, 140px);
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #fff3c9 0%, #ffd97a 45%, #fdc44a 70%, rgba(253,196,74,0) 72%);
    box-shadow: 0 0 70px 30px rgba(253, 205, 96, 0.35);
    animation: sunPulse 8s ease-in-out infinite;
}

@keyframes sunPulse {
    0%, 100% { transform: scale(1);    opacity: 0.85; }
    50%      { transform: scale(1.07); opacity: 1; }
}

/* --- Nuvens --- */
.eco-cloud {
    position: absolute;
    background: #ffffff;
    border-radius: 100px;
    opacity: 0.85;
}

.eco-cloud::before,
.eco-cloud::after {
    content: '';
    position: absolute;
    background: #ffffff;
    border-radius: 50%;
}

.cloud-1 { width: 150px; height: 42px; top: 12%; left: -22%; animation: drift 62s linear infinite; }
.cloud-1::before { width: 62px; height: 62px; top: -26px; left: 26px; }
.cloud-1::after  { width: 44px; height: 44px; top: -18px; left: 84px; }

.cloud-2 { width: 110px; height: 32px; top: 26%; left: -18%; opacity: 0.7; animation: drift 88s linear infinite; animation-delay: -30s; }
.cloud-2::before { width: 48px; height: 48px; top: -20px; left: 20px; }
.cloud-2::after  { width: 34px; height: 34px; top: -13px; left: 62px; }

.cloud-3 { width: 190px; height: 50px; top: 5%; left: -30%; opacity: 0.6; animation: drift 110s linear infinite; animation-delay: -70s; }
.cloud-3::before { width: 76px; height: 76px; top: -32px; left: 34px; }
.cloud-3::after  { width: 56px; height: 56px; top: -22px; left: 108px; }

@keyframes drift {
    from { transform: translateX(0); }
    to   { transform: translateX(180vw); }
}

/* --- Pássaros --- */
.eco-birds { position: absolute; top: 16%; left: 0; width: 100%; height: 60px; }

.bird {
    position: absolute;
    width: 16px;
    height: 8px;
    border-top: 2.5px solid rgba(70, 100, 82, 0.45);
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
    transform-origin: center;
}
.bird::after {
    content: '';
    position: absolute;
    left: 13px; top: -2.5px;
    width: 16px; height: 8px;
    border-top: 2.5px solid rgba(70, 100, 82, 0.45);
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.bird-1 { animation: fly 34s linear infinite, flap 0.7s ease-in-out infinite; }
.bird-2 { top: 26px; animation: fly 44s linear infinite, flap 0.85s ease-in-out infinite; animation-delay: -12s; }
.bird-3 { top: 12px; animation: fly 39s linear infinite, flap 0.62s ease-in-out infinite; animation-delay: -24s; }

@keyframes fly  { from { left: -8%; } to { left: 108%; } }
@keyframes flap { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(0.45); } }

/* --- Colinas --- */
.eco-hills {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: clamp(180px, 30vh, 340px);
}

/* --- Floresta --- */
.eco-forest {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: clamp(150px, 26vh, 280px);
}

.eco-tree {
    position: absolute;
    bottom: 4%;
    height: clamp(90px, 16vh, 175px);
    width: auto;
    transform-origin: 50% 100%;
}

.eco-tree .tree-crown {
    transform-origin: 50% 90%;
    animation: sway 6.5s ease-in-out infinite;
}

.tree-a { left: 3%;   height: clamp(100px, 18vh, 190px); }
.tree-a .tree-crown { animation-duration: 6.2s; }

.tree-b { left: 15%;  bottom: 7%; opacity: 0.95; }
.tree-b .tree-crown { animation-duration: 7.6s; animation-delay: -1.4s; }

.tree-c { right: 6%;  height: clamp(95px, 17vh, 180px); }
.tree-c .tree-crown { animation-duration: 5.8s; animation-delay: -2.6s; }

.tree-d { right: 19%; bottom: 6%; opacity: 0.92; }
.tree-d .tree-crown { animation-duration: 8.1s; animation-delay: -3.8s; }

@keyframes sway {
    0%, 100% { transform: rotate(-1.6deg) scaleY(1); }
    50%      { transform: rotate(1.6deg) scaleY(1.015); }
}

.eco-bush {
    position: absolute;
    bottom: 2%;
    height: clamp(34px, 6vh, 62px);
    transform-origin: 50% 100%;
    animation: sway 9s ease-in-out infinite;
}
.bush-a { left: 28%; }
.bush-b { right: 32%; animation-delay: -4s; }

/* --- Folhas caindo --- */
.leaves-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.leaf {
    position: absolute;
    top: -8%;
    width: 13px;
    height: 13px;
    background: var(--leaf);
    border-radius: 0 100% 0 100%;
    opacity: 0;
    animation: fall linear infinite;
}

.l1 { left:  6%; background: #6cc47f; animation-duration: 15s; animation-delay:  0s;   }
.l2 { left: 18%; background: #94d3a2; animation-duration: 19s; animation-delay: -4s;  width: 10px; height: 10px; }
.l3 { left: 31%; background: #4fae68; animation-duration: 13s; animation-delay: -8s;  }
.l4 { left: 44%; background: #a8d98f; animation-duration: 21s; animation-delay: -2s;  width: 15px; height: 15px; }
.l5 { left: 57%; background: #6cc47f; animation-duration: 17s; animation-delay: -11s; }
.l6 { left: 69%; background: #c9d97f; animation-duration: 14s; animation-delay: -6s;  width: 11px; height: 11px; }
.l7 { left: 80%; background: #4fae68; animation-duration: 23s; animation-delay: -14s; }
.l8 { left: 90%; background: #94d3a2; animation-duration: 16s; animation-delay: -9s;  width: 12px; height: 12px; }
.l9 { left: 96%; background: #e0b96a; animation-duration: 20s; animation-delay: -17s; }

@keyframes fall {
    0%   { transform: translate(0, 0) rotate(0deg);          opacity: 0; }
    8%   {                                                    opacity: 0.75; }
    35%  { transform: translate(42px, 32vh) rotate(180deg);   opacity: 0.7; }
    65%  { transform: translate(-30px, 64vh) rotate(340deg);  opacity: 0.55; }
    92%  {                                                    opacity: 0.25; }
    100% { transform: translate(26px, 104vh) rotate(560deg);  opacity: 0; }
}

/* Acessibilidade: respeita quem prefere menos movimento */
@media (prefers-reduced-motion: reduce) {
    .eco-sun, .eco-cloud, .bird, .eco-tree .tree-crown, .eco-bush, .leaf,
    .vs-tree, .anim-pop, .victory-icon-large {
        animation: none !important;
    }
    .leaves-layer { display: none; }
}


/* ==========================================================================
   CABEÇALHO
   ========================================================================== */

.app-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.7rem;
}

.brand-box { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }

.header-logo {
    width: 38px; height: 38px;
    object-fit: contain;
    border-radius: 9px;
    flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }

.brand-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    color: var(--leaf-dark);
    line-height: 1.1;
}

.brand-tagline {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--leaf-light);
    border: 1px solid #b9e5c5;
    color: var(--leaf-dark);
    font-weight: 700;
    font-size: 0.78rem;
    padding: 0.42rem 0.85rem;
    border-radius: 999px;
    white-space: nowrap;
    transition: var(--transition-fast);
}

.site-link-btn:hover {
    background: var(--leaf);
    border-color: var(--leaf);
    color: #fff;
    transform: translateY(-1px);
}


/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */

.main-content {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.1rem 1rem 2.5rem;
}

.screen-box { animation: fadeUp 0.4s ease both; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ==========================================================================
   BOTÕES
   ========================================================================== */

.btn {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.9rem;
    padding: 0.7rem 1.2rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-bounce);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    line-height: 1.2;
}

.btn:hover  { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.985); }

.btn-lg    { font-size: 1rem; padding: 0.85rem 1.5rem; }
.btn-block { width: 100%; }

.btn-primary {
    background: linear-gradient(135deg, var(--leaf) 0%, var(--leaf-dark) 100%);
    color: #fff;
    box-shadow: 0 5px 16px var(--leaf-glow);
}
.btn-primary:hover { box-shadow: 0 9px 22px var(--leaf-glow); }

.btn-secondary {
    background: #fff;
    color: var(--leaf-dark);
    border: 2px solid var(--leaf);
}
.btn-secondary:hover { background: var(--leaf-light); }

.btn-success {
    background: linear-gradient(135deg, #43b96a 0%, #23864a 100%);
    color: #fff;
    box-shadow: 0 5px 16px rgba(35, 134, 74, 0.25);
}

.btn-danger {
    background: linear-gradient(135deg, #ef5350 0%, #c62828 100%);
    color: #fff;
    box-shadow: 0 5px 16px rgba(198, 40, 40, 0.25);
}

.btn-gold {
    background: linear-gradient(135deg, #f5bd3f 0%, var(--sun) 100%);
    color: #52380a;
}

.btn-icon {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 11px;
    width: 40px; height: 40px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}
.btn-icon:hover { background: var(--leaf-light); border-color: var(--leaf); }
.btn-icon.muted { opacity: 0.4; filter: grayscale(1); }

.margin-top-sm { margin-top: 0.9rem; }


/* ==========================================================================
   TELA INICIAL
   ========================================================================== */

.hero-card {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(6px);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: clamp(1.3rem, 3.5vw, 2.4rem);
    text-align: center;
}

.hero-logo-wrapper { margin-bottom: 0.8rem; }

.hero-logo-img {
    width: clamp(72px, 11vw, 100px);
    height: auto;
    border-radius: 18px;
    box-shadow: var(--shadow-md);
}

.hero-eyebrow {
    display: inline-block;
    background: var(--leaf-light);
    border: 1px solid #b9e5c5;
    color: var(--leaf-dark);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    margin-bottom: 0.7rem;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 4.6vw, 2.5rem);
    font-weight: 900;
    line-height: 1.12;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
}

.hero-title mark {
    background: linear-gradient(180deg, transparent 58%, #bdecc9 58%);
    color: var(--leaf-dark);
    padding: 0 0.15em;
}

.hero-subtitle {
    font-size: clamp(0.88rem, 2vw, 1rem);
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 660px;
    margin: 0 auto 1.4rem;
}

/* --- Cards resumo das fases --- */
.phases-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.7rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.phase-mini-card {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-top: 4px solid var(--leaf);
    border-radius: 14px;
    padding: 0.85rem 0.9rem;
    transition: var(--transition-bounce);
}

.phase-mini-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    background: #fff;
}

.mc-1 { border-top-color: var(--water); }
.mc-2 { border-top-color: #94a3b8; }
.mc-3 { border-top-color: var(--sun); }
.mc-4 { border-top-color: var(--leaf); }

.mini-icon { font-size: 1.6rem; display: block; margin-bottom: 0.3rem; }

.phase-mini-card strong {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.92rem;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.phase-mini-card p { font-size: 0.78rem; color: var(--text-muted); line-height: 1.45; }

/* --- Formulário --- */
.game-setup-box {
    background: var(--bg-cream);
    border: 1px solid #eee5cf;
    border-radius: var(--radius);
    padding: clamp(1rem, 2.6vw, 1.5rem);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.2rem;
}

.game-setup-box h3 {
    font-family: var(--font-heading);
    font-size: 1.08rem;
    color: var(--text-primary);
}

.setup-intro { font-size: 0.83rem; color: var(--text-muted); margin-top: -0.45rem; }

.input-group { display: flex; flex-direction: column; gap: 0.3rem; }

.input-group label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.input-group input {
    background: #fff;
    border: 1.5px solid #d8e6db;
    border-radius: 10px;
    padding: 0.65rem 0.8rem;
    font-family: var(--font-body);
    font-size: 0.92rem;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.input-group input:focus {
    outline: none;
    border-color: var(--leaf);
    box-shadow: 0 0 0 3px var(--leaf-glow);
}

.input-group input.input-invalid {
    border-color: var(--alert);
    background: var(--alert-light);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
    animation: shake 0.35s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-5px); }
    75%      { transform: translateX(5px); }
}

.setup-error {
    background: var(--alert-light);
    border: 1px solid #fca5a5;
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: #991b1b;
    text-align: center;
    line-height: 1.45;
}

.setup-privacy-note {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.45;
}

/* --- Banner de marketing --- */
.marketing-footer-banner {
    background: var(--sun-light);
    border: 1px solid #f5e0ac;
    border-radius: 12px;
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    color: #6b4c10;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.marketing-footer-banner a {
    font-weight: 800;
    color: #a1620a;
    text-decoration: underline;
}


/* ==========================================================================
   ARENA DO JOGO — STATUS E TRILHA
   ========================================================================== */

.game-status-bar {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.7rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(6px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.6rem 0.85rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0.7rem;
}

.player-score-card { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }

.avatar-icon {
    width: 42px; height: 42px;
    display: grid;
    place-items: center;
    background: var(--leaf-light);
    border: 1px solid #b9e5c5;
    border-radius: 12px;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.score-info { display: flex; flex-direction: column; min-width: 0; }

.player-name {
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.score-line { font-size: 0.78rem; color: var(--text-muted); }

.score-value {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--leaf-dark);
}

.center-round-info { text-align: center; min-width: 0; }

.phase-title-text {
    font-family: var(--font-heading);
    font-size: clamp(0.9rem, 2.1vw, 1.1rem);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.phase-sub-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* --- Trilha das fases --- */
.phase-steps-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.step-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 0.5rem 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    transition: var(--transition-fast);
}

.step-emoji { font-size: 1.15rem; filter: grayscale(0.7); opacity: 0.65; transition: var(--transition-fast); }
.step-label { line-height: 1.15; }

.step-badge.active {
    background: linear-gradient(135deg, var(--leaf) 0%, var(--leaf-dark) 100%);
    border-color: var(--leaf-dark);
    color: #fff;
    box-shadow: 0 5px 14px var(--leaf-glow);
    transform: translateY(-2px);
}
.step-badge.active .step-emoji { filter: none; opacity: 1; transform: scale(1.12); }

.step-badge.completed {
    background: var(--leaf-light);
    border-color: #b9e5c5;
    color: var(--leaf-dark);
}
.step-badge.completed .step-emoji { filter: none; opacity: 1; }
.step-badge.completed .step-label::after { content: ' ✓'; font-weight: 900; }


/* ==========================================================================
   ELEMENTOS COMUNS DAS FASES
   ========================================================================== */

.phase-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(6px);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: clamp(0.9rem, 2.6vw, 1.5rem);
}

.container-label {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.wrapper-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.remaining-pill {
    background: var(--leaf-light);
    border: 1px solid #b9e5c5;
    color: var(--leaf-dark);
    font-size: 0.74rem;
    font-weight: 800;
    padding: 0.24rem 0.7rem;
    border-radius: 999px;
    white-space: nowrap;
    margin-bottom: 0.5rem;
}

.progress-track {
    height: 8px;
    background: #e8f4ea;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.9rem;
}

.progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #6cc47f 0%, var(--leaf) 60%, var(--leaf-dark) 100%);
    transition: width 0.5s cubic-bezier(0.34, 1.2, 0.64, 1);
}

/* --- Banners narrativos --- */
.story-banner {
    border-radius: var(--radius);
    padding: 0.9rem 1.05rem;
    margin-bottom: 1rem;
    border-left: 5px solid var(--leaf);
    background: var(--leaf-light);
}

.story-banner h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

.story-text { font-size: 0.85rem; line-height: 1.55; color: var(--text-secondary); }

.banner-blue  { background: var(--water-light); border-left-color: var(--water); }
.banner-green { background: var(--leaf-light);  border-left-color: var(--leaf); }
.banner-alert { background: var(--alert-light); border-left-color: var(--alert); }
.banner-alert h3 { color: #991b1b; }


/* ==========================================================================
   FASE 1 — COLETA SELETIVA
   ========================================================================== */

.instruction-box {
    background: var(--bg-soft);
    border: 1px dashed #b9e5c5;
    border-radius: var(--radius);
    padding: clamp(0.9rem, 2.4vw, 1.3rem);
}

.instruction-box h3 {
    font-family: var(--font-heading);
    font-size: 1.02rem;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

.instructions-lead { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 0.9rem; }

.color-guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.6rem;
}

.color-guide-card {
    background: #fff;
    border-radius: 13px;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-left: 6px solid #cbd5e1;
    transition: var(--transition-bounce);
}

.color-guide-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.guide-header { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.25rem; }
.guide-icon { font-size: 1.3rem; }

.guide-color-title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 0.03em;
}

.guide-type { font-size: 0.83rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.15rem; }
.guide-desc { font-size: 0.74rem; color: var(--text-muted); line-height: 1.45; }

.bg-papel    { border-left-color: #0284c7; } .bg-papel    .guide-color-title { color: #0369a1; }
.bg-plastico { border-left-color: #dc2626; } .bg-plastico .guide-color-title { color: #b91c1c; }
.bg-metal    { border-left-color: #eab308; } .bg-metal    .guide-color-title { color: #a16207; }
.bg-vidro    { border-left-color: #16a34a; } .bg-vidro    .guide-color-title { color: #15803d; }
.bg-organico { border-left-color: #78350f; } .bg-organico .guide-color-title { color: #78350f; }

/* --- Lixeiras --- */
.bins-wrapper { margin-bottom: 1.2rem; }

.bins-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.55rem;
}

.bin-card {
    background: #fff;
    border: 2.5px solid #cbd5e1;
    border-radius: 14px;
    padding: 0.75rem 0.4rem 0.6rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-bounce);
    position: relative;
    overflow: hidden;
}

.bin-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 34%;
    background: currentColor;
    opacity: 0.12;
}

.bin-card:hover { transform: translateY(-5px) scale(1.03); box-shadow: var(--shadow-md); }
.bin-card.drag-over { transform: scale(1.08); box-shadow: 0 0 0 4px var(--leaf-glow); }

.bin-icon { font-size: 1.9rem; line-height: 1; position: relative; }

.bin-color-tag {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
    position: relative;
}

.bin-papel    { border-color: #0284c7; color: #0369a1; }
.bin-plastico { border-color: #dc2626; color: #b91c1c; }
.bin-metal    { border-color: #eab308; color: #a16207; }
.bin-vidro    { border-color: #16a34a; color: #15803d; }
.bin-organico { border-color: #78350f; color: #78350f; }

/* --- Resíduos --- */
.waste-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 0.55rem;
    background: linear-gradient(180deg, #f7fbf5 0%, #eef7ec 100%);
    border: 1px dashed #cfe6d2;
    border-radius: var(--radius);
    padding: 0.7rem;
    min-height: 100px;
}

.waste-item {
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 0.6rem 0.35rem;
    text-align: center;
    cursor: grab;
    transition: var(--transition-bounce);
    user-select: none;
}

.waste-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--leaf); }
.waste-item:active { cursor: grabbing; }

.waste-item.selected {
    border-color: var(--leaf);
    background: var(--leaf-light);
    box-shadow: 0 0 0 3px var(--leaf-glow);
    transform: translateY(-4px) scale(1.04);
}

.waste-item.selected::after {
    content: 'selecionado';
    display: block;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--leaf-dark);
    margin-top: 0.15rem;
}

.item-icon { font-size: 1.7rem; line-height: 1; }

.item-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    line-height: 1.25;
    margin-top: 0.25rem;
}


/* ==========================================================================
   FASE 2 — CARBONO
   ========================================================================== */

.activity-area { margin-bottom: 1rem; }

.activity-card {
    background: linear-gradient(180deg, #ffffff 0%, var(--bg-soft) 100%);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-lg);
    padding: clamp(1.2rem, 3.4vw, 2rem);
    text-align: center;
    box-shadow: var(--shadow-md);
}

.card-icon-large { font-size: clamp(2.6rem, 8vw, 4rem); line-height: 1; margin-bottom: 0.5rem; }

.card-title-large {
    font-family: var(--font-heading);
    font-size: clamp(1.05rem, 2.8vw, 1.4rem);
    font-weight: 800;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.card-desc-large {
    font-size: 0.87rem;
    color: var(--text-muted);
    line-height: 1.55;
    max-width: 520px;
    margin: 0 auto;
}

.classify-buttons-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}


/* ==========================================================================
   FASE 3 — VAZAMENTO DE ÓLEO
   ========================================================================== */

.contingency-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 0.6rem;
    margin-bottom: 1.1rem;
}

.contingency-card {
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    padding: 0.8rem 0.7rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-bounce);
}

.contingency-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--sun);
    background: var(--sun-light);
}

.contingency-card.used {
    opacity: 0.45;
    pointer-events: none;
    filter: grayscale(0.6);
}

.card-icon-medium { font-size: 1.8rem; line-height: 1; margin-bottom: 0.3rem; }

.card-title-medium {
    font-family: var(--font-heading);
    font-size: 0.86rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    line-height: 1.25;
}

.card-desc-medium { font-size: 0.73rem; color: var(--text-muted); line-height: 1.45; }

.contingency-log-box {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
}

.contingency-log-box h4 {
    font-family: var(--font-heading);
    font-size: 0.86rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.log-list { display: flex; flex-direction: column; gap: 0.35rem; }

.log-item {
    background: #fff;
    border-left: 3px solid var(--leaf);
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    animation: fadeUp 0.3s ease both;
}

.log-item.warn { border-left-color: var(--sun); }

.empty-log { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }


/* ==========================================================================
   FASE 4 — MEMÓRIA FLORESTAL
   ========================================================================== */

.reforest-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.planted-badge {
    background: var(--leaf-light);
    border: 1px solid #b9e5c5;
    border-radius: 999px;
    padding: 0.26rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--leaf-dark);
    margin-bottom: 0.5rem;
}

.memory-board-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    max-width: 640px;
    margin: 0 auto;
}

.memory-card {
    aspect-ratio: 3 / 4;
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition-bounce);
    overflow: hidden;
    position: relative;
}

.memory-card:hover { transform: translateY(-4px) scale(1.03); }

.memory-card-back,
.memory-card-front {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    border-radius: 14px;
    padding: 0.4rem;
    text-align: center;
}

.memory-card-back {
    background:
        radial-gradient(circle at 30% 25%, rgba(255,255,255,0.28) 0%, transparent 55%),
        linear-gradient(135deg, #4cb469 0%, #1f7a3c 100%);
    border: 2px solid #1f7a3c;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.22);
}

.memory-logo-icon { font-size: clamp(1.5rem, 5vw, 2.1rem); filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2)); }

.memory-card-front {
    background: linear-gradient(180deg, #ffffff 0%, var(--bg-soft) 100%);
    border: 2px solid var(--leaf);
}

.memory-plant-icon { font-size: clamp(1.5rem, 5vw, 2.2rem); line-height: 1; }

.memory-plant-name {
    font-size: 0.62rem;
    font-weight: 800;
    color: var(--text-secondary);
    line-height: 1.15;
}

.memory-card.matched .memory-card-front {
    border-color: #8fd6a3;
    background: linear-gradient(180deg, #eefaf0 0%, #d8f2e0 100%);
    box-shadow: 0 0 0 3px rgba(47, 158, 81, 0.18);
}

.memory-card.matched { cursor: default; animation: matchedPop 0.45s var(--transition-bounce); }

@keyframes matchedPop {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.09); }
    100% { transform: scale(1); }
}


/* ==========================================================================
   TELA DE VITÓRIA
   ========================================================================== */

.victory-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(6px);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: clamp(1.4rem, 3.5vw, 2.4rem);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.victory-scene {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    height: 90px;
    pointer-events: none;
    opacity: 0.16;
}

.vs-tree {
    position: absolute;
    bottom: 0;
    font-size: 3.4rem;
    transform-origin: 50% 100%;
    animation: sway 7s ease-in-out infinite;
}
.t1 { left: 3%;  }
.t2 { left: 22%; animation-delay: -2s; font-size: 2.8rem; }
.t3 { right: 8%; animation-delay: -4s; }
.t4 { right: 26%; animation-delay: -1s; font-size: 3rem; }

.victory-icon-large {
    font-size: clamp(3rem, 9vw, 4.4rem);
    line-height: 1;
    margin-bottom: 0.4rem;
    animation: spinGlobe 9s ease-in-out infinite;
    display: inline-block;
}

@keyframes spinGlobe {
    0%, 100% { transform: rotate(-8deg) scale(1); }
    50%      { transform: rotate(8deg) scale(1.06); }
}

.victory-title {
    font-family: var(--font-heading);
    font-size: clamp(1.35rem, 4.2vw, 2.1rem);
    font-weight: 900;
    color: var(--leaf-dark);
    line-height: 1.15;
    margin-bottom: 0.5rem;
}

.victory-subtitle {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto 1.4rem;
}

.final-scores-box {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem;
    margin-bottom: 1.2rem;
}

.final-scores-box h3 {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.final-score-pill {
    display: inline-block;
    background: linear-gradient(135deg, var(--leaf) 0%, var(--leaf-dark) 100%);
    color: #fff;
    font-family: var(--font-heading);
    font-size: clamp(1.3rem, 4vw, 1.9rem);
    font-weight: 900;
    padding: 0.5rem 1.6rem;
    border-radius: 999px;
    box-shadow: 0 6px 18px var(--leaf-glow);
}

.player-name-sub {
    margin-top: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.final-badge {
    margin-top: 0.7rem;
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--leaf-dark);
    background: var(--leaf-light);
    border: 1px solid #b9e5c5;
    border-radius: 999px;
    padding: 0.3rem 0.9rem;
}

.victory-actions-row { margin-bottom: 1.4rem; }

.marketing-cta-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--sun-light);
    border: 1px solid #f5e0ac;
    border-radius: var(--radius);
    padding: 1rem;
    text-align: left;
}

.cta-logo { width: 62px; height: 62px; object-fit: contain; border-radius: 14px; flex-shrink: 0; }

.cta-text h4 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: #6b4c10;
    margin-bottom: 0.2rem;
}

.cta-text p { font-size: 0.8rem; color: #8a6516; margin-bottom: 0.6rem; line-height: 1.45; }


/* ==========================================================================
   MODAIS
   ========================================================================== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom));
    background: rgba(15, 42, 26, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow-y: auto;
    animation: fadeIn 0.22s ease both;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(15, 42, 26, 0.4);
    width: min(500px, 100%);
    overflow: hidden;
}

.anim-pop { animation: pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

@keyframes pop {
    from { opacity: 0; transform: translateY(16px) scale(0.94); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header { padding: 1.1rem 1.2rem 0.5rem; text-align: center; }

.feedback-badge {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    padding: 0.26rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 0.5rem;
}

.badge-success { background: var(--leaf-light); color: var(--leaf-dark); border: 1px solid #b9e5c5; }
.badge-danger  { background: var(--alert-light); color: #991b1b; border: 1px solid #fca5a5; }
.badge-warning { background: var(--sun-light); color: #92400e; border: 1px solid #fcd34d; }

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.25;
}

.text-success { color: var(--leaf-dark); }
.text-danger  { color: #b91c1c; }

.modal-body { padding: 0.5rem 1.2rem 1rem; }

.lead-text { font-size: 0.9rem; line-height: 1.6; color: var(--text-secondary); text-align: center; }

.modal-footer { padding: 0 1.2rem 1.2rem; }


/* ==========================================================================
   RESPONSIVO
   ========================================================================== */

@media (max-width: 860px) {
    .bins-grid { grid-template-columns: repeat(5, 1fr); gap: 0.35rem; }
    .bin-icon { font-size: 1.5rem; }
    .bin-color-tag { font-size: 0.58rem; }
    .memory-board-grid { max-width: 480px; }
}

@media (max-width: 640px) {
    .main-content { padding: 0.8rem 0.7rem 2rem; }

    .brand-tagline { display: none; }
    .brand-title { font-size: 0.88rem; }
    .site-link-btn { font-size: 0.68rem; padding: 0.35rem 0.6rem; }
    .header-logo { width: 32px; height: 32px; }

    .game-status-bar {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "info  sound"
            "phase phase";
        gap: 0.5rem;
    }
    .player-score-card  { grid-area: info; }
    .btn-icon           { grid-area: sound; }
    .center-round-info  { grid-area: phase; text-align: left; }

    .player-name { max-width: 40vw; }

    .step-badge { font-size: 0.62rem; padding: 0.4rem 0.15rem; border-radius: 10px; }
    .step-emoji { font-size: 1rem; }

    .phases-summary-grid { grid-template-columns: 1fr 1fr; }
    .color-guide-grid { grid-template-columns: 1fr 1fr; }

    .bins-grid { grid-template-columns: repeat(5, 1fr); gap: 0.25rem; }
    .bin-card { padding: 0.5rem 0.15rem 0.4rem; }
    .bin-icon { font-size: 1.3rem; }
    .bin-color-tag { font-size: 0.52rem; letter-spacing: 0; }

    .waste-grid { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 0.4rem; }
    .item-icon { font-size: 1.4rem; }
    .item-name { font-size: 0.63rem; }

    .classify-buttons-row { grid-template-columns: 1fr; }
    .contingency-grid { grid-template-columns: 1fr 1fr; }

    .memory-board-grid { grid-template-columns: repeat(3, 1fr); max-width: 360px; }

    .marketing-cta-box { flex-direction: column; text-align: center; }

    .input-group input { font-size: 16px; } /* evita zoom automático no iOS */

    .eco-sun { width: 66px; height: 66px; top: 4%; right: 5%; }
    .tree-b, .tree-d { display: none; }
}

@media (max-width: 380px) {
    .phases-summary-grid { grid-template-columns: 1fr; }
    .color-guide-grid { grid-template-columns: 1fr; }
    .bins-grid { grid-template-columns: repeat(3, 1fr); }
    .contingency-grid { grid-template-columns: 1fr; }
    .memory-board-grid { grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
}

@media (max-height: 520px) and (orientation: landscape) {
    .eco-forest, .eco-hills { height: 120px; }
    .modal-backdrop { align-items: flex-start; }
}
