:root{
    --blue:#2f7fd6;
    --blue-dark:#1d5fae;
    --orange:#ff9a2e;
    --green:#3fb35a;
    --green-dark:#2b8d44;
    --ink:#24405f;
    --card-radius:22px;
}
*{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html,body{ margin:0; padding:0; }
body{
    font-family:'Nunito', 'Trebuchet MS', sans-serif;
    min-height:100vh;
    background:url("2_1.svg");
    background-repeat: no-repeat;
    background-size: cover;
    color:var(--ink);
    display:flex; align-items:center; justify-content:center;
    padding:14px;
}

/* ================= stage ================= */
.stage{
    position:relative;
    width:100%;
    /*max-width:1180px;*/
    border-radius:30px;
    overflow:hidden;
    background:#fff center/cover no-repeat;
    box-shadow:0 18px 44px rgba(20,60,110,.35), inset 0 0 0 4px rgba(255,255,255,.7);
    padding:20px 30px 26px;
}
/*.stage::before{ !* soft light veil so the cards pop *!*/
/*    content:''; position:absolute; inset:0;*/
/*    !*background:linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,.05) 55%, rgba(255,255,255,.18));*!*/
/*    pointer-events:none;*/
/*}*/
.stage > *{ position:relative; }

/* ---- header ---- */
.top{
    display:flex; align-items:center; justify-content:space-between; gap:16px;
    margin-bottom:14px;
}
.title{
    font-weight:900;
    font-size:clamp(22px,3.4vw,38px);
    line-height:1;
    color:var(--blue);
    -webkit-text-stroke:0;
    text-shadow:
            -3px -3px 0 #fff, 3px -3px 0 #fff, -3px 3px 0 #fff, 3px 3px 0 #fff,
            0 -3px 0 #fff, 0 3px 0 #fff, -3px 0 0 #fff, 3px 0 0 #fff,
            0 5px 0 rgba(30,80,150,.25);
    letter-spacing:.5px;
}
.title span{ color:var(--orange); }
.stars{ display:flex; gap:6px; background:rgba(255,255,255,.85); padding:7px 14px; border-radius:999px; box-shadow:0 4px 10px rgba(30,80,150,.2); }
.star{ width:30px; height:30px; transition:transform .35s cubic-bezier(.3,1.8,.5,1), filter .3s; filter:grayscale(1) opacity(.45); }
.star.on{ filter:none; transform:scale(1.18) rotate(-8deg); }

/* ---- layout ---- */
.play{
    display:grid;
    grid-template-columns: minmax(250px, 31%) 1fr;
    gap:3.5%;
    align-items:end;
}

/* ---- bear column ---- */
.bear-col{
    position:relative;
    display:flex; flex-direction:column; align-items:center; justify-content:center;
    min-height:100%;
    z-index:1;
}
.bubble{
    position:relative;
    width:100%;
    background:#fff;
    border-radius:26px;
    padding:16px 18px 14px;
    /*box-shadow:0 8px 18px rgba(30,80,150,.25);*/
    font-weight:900;
    font-size:clamp(18px,2.15vw,27px);
    line-height:1.2;
    text-align:center;
    color:var(--blue-dark);
    margin-bottom:18px;
    min-height:84px;
    display:flex; flex-direction:column; align-items:baseline; justify-content:center; gap:8px;
}
/*.bubble::after{*/
/*    content:''; position:absolute; left:50%; bottom:-16px; margin-left:-16px;*/
/*    border:16px solid transparent; border-top-color:#fff; border-bottom:0;*/
/*    filter:drop-shadow(0 4px 3px rgba(30,80,150,.18));*/
/*}*/
/*.bubble.wrong{ color:#d2453a; }*/
/*.bubble.right{ color:var(--green-dark); }*/
/*@keyframes bubbleIn{ from{ transform:translateY(8px) scale(.96); opacity:0; } to{ transform:none; opacity:1; } }*/


.btn, .replay{
    font:inherit; font-weight:900; font-size:clamp(20px,2.6vw,30px); color:#fff; cursor:pointer;
    border:0; border-radius:20px; padding:14px 46px;
    background:linear-gradient(180deg,#58c874,#38a655);
    box-shadow:0 7px 0 #27803e, 0 14px 22px rgba(20,80,40,.3);
    transition:transform .12s, box-shadow .12s;
}
.btn:hover{ filter:brightness(1.06); }
.btn:active{ transform:translateY(5px); box-shadow:0 2px 0 #27803e; }
.again{ display:block; }
.again[hidden]{ display:none; }

.replay {
    border:0; cursor:pointer; color:#fff;
    background:linear-gradient(180deg,#4aa3f0,#2f7fd6);
    /*padding:6px 14px; border-radius:999px;*/
    box-shadow:0 3px 0 #1d5fae;
}
.replay:active{ transform:translateY(2px); box-shadow:0 1px 0 #1d5fae; }
.replay[hidden]{ display:none; }

/*.bear-wrap{*/
/*    position:relative;*/
/*    width:100%;*/
/*    !*height:clamp(250px,34vw,400px);*!*/
/*    display:flex; align-items:flex-end; justify-content:center;*/
/*    pointer-events:none;*/
/*}*/
.player {
    width: 100%;
    position:relative;
    aspect-ratio: 16 / 9;
    display:flex; align-items:flex-end; justify-content:center;
    pointer-events:none;
}
.bear-shadow{
    position:absolute; bottom:-6px; left:50%; width:56%; height:20px; margin-left:-28%;
    background:radial-gradient(ellipse at center, rgba(20,50,20,.38), transparent 70%);
}
.bear{
    position:relative;
    height:70vh;
    width:auto;
    max-width:none;
    transform-origin:50% 100%;
    user-select:none; -webkit-user-drag:none;
}


.player video,
.player .cover {
    inset: 0;
    position:relative;
    height:70vh;
    width:auto;
    max-width:none;
    object-fit: contain;
}

.player .cover {
    display: none;
    pointer-events: none;
}
.player video {
    display: block;
}

.player.switching .cover {
    /*visibility: visible;*/
    display: block;
}
.player.switching video {
    display: none;
}
/*.bear.cheer{ height:100%; width:auto; }*/
.play.finale .bubble{ font-size:clamp(14px,1.55vw,20px); }

/* ---- cards ---- */
.grid{
    display:grid; grid-template-columns:1fr 1fr; gap:3vw 3vw;
    padding:12px;
    position:relative; z-index:2;
}
.card{
    position:relative;
    border:0; padding:0; margin:0; cursor:pointer;
    background:#fff;
    border-radius:var(--card-radius);
    padding:7px;
    box-shadow:0 10px 22px rgba(20,60,110,.3);
    transition:transform .35s cubic-bezier(.3,1.5,.5,1), box-shadow .25s, outline-color .2s;
    outline:5px solid transparent;
    font:inherit;
}
.card img{
    display:block; width:100%; aspect-ratio:16/10; object-fit:cover;
    border-radius:calc(var(--card-radius) - 6px);
    pointer-events:none; -webkit-user-drag:none; user-select:none;
}
.card.can-hover:hover{ transform:translateY(-4px) scale(1.02); }
.card:active{ transform:scale(.98); }
.card.done{
    transform:scale(1.07);
    outline-color:var(--green);
    box-shadow:0 14px 30px rgba(43,141,68,.45);
    cursor:default;
    z-index:3;
}
.card.done:hover{ transform:scale(1.07); }


.badge{
    position:absolute; right:-10px; top:-10px; width:44px; height:44px; border-radius:50%;
    background:var(--green); color:#fff; font-size:26px; font-weight:900; line-height:44px; text-align:center;
    box-shadow:0 4px 8px rgba(0,0,0,.3);
    transform:scale(0); transition:transform .4s cubic-bezier(.3,1.9,.5,1);
}
.card.done .badge{ transform:scale(1); }
.ribbon{
    position:absolute; left:50%; bottom:-14px; transform:translateX(-50%) scale(0);
    background:linear-gradient(180deg,#ffb347,#ff8f1f); color:#fff;
    font-weight:900; font-size:clamp(15px,1.7vw,22px); padding:4px 20px; border-radius:999px;
    box-shadow:0 4px 0 #d4701a, 0 8px 12px rgba(0,0,0,.2);
    transition:transform .4s cubic-bezier(.3,1.9,.5,1) .1s;
    white-space:nowrap;
}
.card.done .ribbon{ transform:translateX(-50%) scale(1); }

/* ---- overlays ---- */
.overlay{
    position:absolute; inset:0; z-index:20;
    display:flex; align-items:center; justify-content:center;
    background:rgba(120,190,240,.55);
    backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px);
}
.overlay[hidden]{ display:none; }
.start-card{
    background:#fff; border-radius:34px; padding:26px 44px 30px; text-align:center;
    box-shadow:0 18px 40px rgba(20,60,110,.4);
    display:flex; flex-direction:column; align-items:center; gap:6px;
}
.start-card img{ height:clamp(180px,30vw,300px); width:auto; transform-origin:50% 100%; }
.start-card h1{ margin:0; font-size:clamp(30px,5vw,54px); font-weight:900; color:var(--blue); line-height:1.05; }
.start-card h1 span{ color:var(--orange); }
.start-card p{ margin:2px 0 12px; font-weight:800; font-size:clamp(15px,2vw,20px); color:#5d7a9a; }


.confetti-piece{ position:fixed; top:-20px; z-index:200; pointer-events:none; border-radius:2px; }
@keyframes fall{ to{ transform:translateY(112vh) rotate(600deg); opacity:.95; } }

/* ---- narrow screens: bear above, 2x2 below ---- */
@media (max-width:820px){
    .stage{ padding:14px 14px 20px; height: 95vh; }
    .play{ grid-template-columns:1fr; gap:10px; }
    .bear-col{ flex-direction: column; align-items:flex-end; gap:8px;  }
    .bubble{ margin-bottom:0; flex:1; min-height:70px; }
    .bear-wrap{ width:100%; flex:none; margin: 3vh 0; }
    .bear {height: 23vh; box-shadow: none; }
    .player video,
    .player .cover {
        height: 23vh; box-shadow: none;
    }
    .btn, .replay{
        font-size: 1.5vh;
    }
    .play.finale .bubble{ font-size:15px; }
    .grid{ gap:4vh; padding:6px 8px 22px; }
    .bubble::after{ left:auto; right:-14px; bottom:26px; margin:0; border:14px solid transparent; border-left-color:#fff; border-right:0; border-top-color:transparent; }
}
