/* =========================================================
   Young Heroes - in-game styles
   ========================================================= */

.game-wrap { max-width: 720px; margin: 0 auto; }

.game-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.game-title {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.15rem;
    color: #0b4f6c;
    text-shadow: 0 2px 0 rgba(255, 255, 255, .6);
}

.gt-emoji { font-size: 24px; }

.streak-box {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff;
    font-weight: 800;
    box-shadow: var(--shadow-s);
    transition: transform .2s;
}

.streak-box .fire { filter: grayscale(1); opacity: .5; transition: all .3s; }
.streak-box.hot { background: linear-gradient(135deg, #ffd8a8, #ffa8a8); transform: scale(1.06); }
.streak-box.hot .fire { filter: none; opacity: 1; animation: flame .8s ease-in-out infinite; }

@keyframes flame { 0%, 100% { transform: scale(1) } 50% { transform: scale(1.25) rotate(-6deg) } }

.progress-track {
    position: relative;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .7);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, .08);
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--game), color-mix(in srgb, var(--game) 50%, white));
    border-radius: 999px;
    transition: width .5s cubic-bezier(.2, .9, .3, 1.4);
}

.progress-label {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: .78rem;
    font-weight: 700;
    color: var(--ink);
}

.game-card {
    text-align: center;
    padding: 26px 20px;
    min-height: 340px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.game-card.loading { opacity: .4; }

.q-prompt { font-size: 1.15rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.q-prompt-ar { font-size: 1.05rem; color: var(--ink-soft); }
.q-sub { font-size: .9rem; color: var(--ink-soft); margin-top: 4px; }

.q-text { display: inline-block; }

.sum {
    display: inline-block;
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: 800;
    color: var(--ink);
    letter-spacing: 1px;
}

.op-sign { color: var(--game); }
.qmark { color: var(--game); animation: blink 1.4s ease-in-out infinite; }

@keyframes blink { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }

.q-visual { margin: 14px 0 10px; }

/* counting objects */
.counters { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: 100%; }
.counters.tight { gap: 1px; }

.counter {
    font-size: 30px;
    animation: dropIn .45s cubic-bezier(.2, .9, .3, 1.6) both;
}

.counter.gone { opacity: .22; filter: grayscale(1); text-decoration: line-through; }

@keyframes dropIn { from { transform: translateY(-22px) scale(.4); opacity: 0 } to { transform: none; opacity: 1 } }

.op { font-size: 30px; font-weight: 800; color: var(--game); margin: 0 8px; }

.groups { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

.group {
    padding: 6px 8px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--game) 12%, white);
    border: 2px dashed color-mix(in srgb, var(--game) 45%, white);
}

.group .counter { font-size: 22px; }

/* sequences */
.sequence { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }

.seq {
    font-size: 1.6rem;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 12px;
    background: var(--paper-2);
}

.seq-hole { background: color-mix(in srgb, var(--game) 18%, white); color: var(--game); }
.seq-dash { color: var(--ink-soft); }

.crystal { font-size: 70px; animation: floaty 3s ease-in-out infinite; }

/* pictures & words */
.big-pic {
    font-size: clamp(66px, 20vw, 100px);
    line-height: 1.1;
    filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .18));
}

.big-pic.pulse { animation: floaty 3.2s ease-in-out infinite; }

.word-card {
    display: inline-block;
    margin-top: 8px;
    padding: 10px 26px;
    border-radius: var(--r-m);
    background: color-mix(in srgb, var(--game) 12%, white);
    font-size: 2rem;
    font-weight: 800;
    color: var(--ink);
    box-shadow: var(--shadow-s);
}

.word-card.small { font-size: 1.4rem; padding: 8px 20px; }
.word-card.ar { font-family: var(--font-ar); }
.word-card small { display: block; font-size: .95rem; color: var(--ink-soft); font-family: var(--font-ar); }

.listen-box { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.listen-btn {
    width: 110px;
    height: 110px;
    border: none;
    border-radius: 50%;
    font-size: 46px;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, var(--game), color-mix(in srgb, var(--game) 45%, white));
    box-shadow: var(--shadow-m);
    animation: ring 2.4s ease-in-out infinite;
}

@keyframes ring {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--game) 45%, transparent), var(--shadow-m) }
    50% { box-shadow: 0 0 0 18px transparent, var(--shadow-m) }
}

.listen-hint { font-size: .85rem; color: var(--ink-soft); }

/* options */
.options { display: grid; gap: 12px; margin-top: 18px; }
.options.grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.options.wide { grid-template-columns: repeat(2, 1fr); }
.options.pictures { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

.opt {
    position: relative;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--ink);
    padding: 18px 10px;
    border-radius: var(--r-m);
    background: #fff;
    box-shadow: 0 5px 0 #e2e7fb, var(--shadow-s);
    transition: transform .14s, box-shadow .14s, background .25s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    overflow: hidden;
}

.opt::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, .8), transparent 60%);
    opacity: 0;
    transition: opacity .3s;
}

.opt:hover { transform: translateY(-4px); box-shadow: 0 9px 0 #e2e7fb, var(--shadow-m); }
.opt:hover::after { opacity: .6; }
.opt:active { transform: translateY(2px); box-shadow: 0 2px 0 #e2e7fb; }

.opt.right {
    background: linear-gradient(135deg, #b2f2bb, #69db7c);
    box-shadow: 0 5px 0 #2f9e44;
    animation: rightPop .5s cubic-bezier(.2, .9, .3, 1.6);
}

@keyframes rightPop { 0% { transform: scale(1) } 45% { transform: scale(1.14) } 100% { transform: scale(1) } }

.opt.wrong {
    background: linear-gradient(135deg, #ffc9c9, #ff8787);
    box-shadow: 0 5px 0 #e03131;
    opacity: .75;
}

.opt-pic { font-size: 3rem; padding: 14px 6px; }
.pic { font-size: 3rem; line-height: 1.1; }
.word { font-size: 1.5rem; }
.word.ar { font-family: var(--font-ar); }
.bignum { font-size: 2.4rem; }

.opt-sub { font-size: .8rem; color: var(--ink-soft); font-weight: 600; }

.ar-help {
    font-family: var(--font-ar);
    font-size: .85rem;
    color: var(--ink-soft);
    font-weight: 600;
}

/* number input */
.input-row { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

.num-input {
    font-family: inherit;
    font-size: 2rem;
    font-weight: 800;
    width: 150px;
    text-align: center;
    padding: 10px;
    border-radius: var(--r-m);
    border: 3px solid #e4e9ff;
    background: var(--paper-2);
    outline: none;
}

.num-input:focus { border-color: var(--game); }
.num-input::-webkit-outer-spin-button, .num-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-input { -moz-appearance: textfield; }

/* spelling */
.build-slot { display: flex; justify-content: center; gap: 8px; margin: 18px 0 14px; flex-wrap: wrap; }

.slot {
    width: 46px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 3px dashed #cdd5f0;
    background: var(--paper-2);
    font-size: 1.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

.slot.filled {
    border-style: solid;
    border-color: var(--game);
    background: color-mix(in srgb, var(--game) 12%, white);
    animation: popIn .3s cubic-bezier(.2, .9, .3, 1.6);
}

.slot.hintfill { border-color: var(--green); background: #ebfbee; }

.letters { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

.letter {
    width: 52px;
    height: 58px;
    border: none;
    border-radius: 14px;
    font-family: inherit;
    font-size: 1.6rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--ink);
    background: #fff;
    cursor: pointer;
    box-shadow: 0 5px 0 #e2e7fb, var(--shadow-s);
    transition: transform .12s, opacity .2s;
}

.letter:hover { transform: translateY(-4px); }
.letter.used { opacity: .25; transform: scale(.9); }

.letter-tools { margin-top: 14px; }

/* feedback */
.feedback {
    min-height: 30px;
    margin-top: 16px;
    font-size: 1.15rem;
    font-weight: 800;
    opacity: 0;
    transform: translateY(6px);
    transition: all .3s;
}

.feedback.show { opacity: 1; transform: none; }
.feedback.good { color: #2b8a3e; }
.feedback.bad { color: #c92a2a; }
.feedback.warn { color: #d9480f; }

.game-foot { display: flex; justify-content: center; margin-top: 16px; }

/* results */
.results { max-width: 480px; margin: 24px auto; text-align: center; }
.res-stars { font-size: 3rem; letter-spacing: 6px; margin-bottom: 6px; }
.res-stars .star.on { animation: starPop .6s cubic-bezier(.2, .9, .3, 1.7) both; }
.res-stars .star.on:nth-child(2) { animation-delay: .18s; }
.res-stars .star.on:nth-child(3) { animation-delay: .36s; }

@keyframes starPop { 0% { transform: scale(0) rotate(-40deg); opacity: 0 } 100% { transform: none; opacity: 1 } }

.res-msg { font-size: 1.15rem; color: var(--ink-soft); }
.res-best { color: #e8590c; font-weight: 800; }
.res-rows { margin: 18px 0; }

.res-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 4px;
    border-bottom: 2px solid var(--line);
    font-size: 1rem;
}

.res-row span { color: var(--ink-soft); }
.res-row b { font-size: 1.15rem; }

.res-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

@media (max-width: 560px) {
    .game-card { padding: 20px 14px; min-height: 300px; }
    .opt { font-size: 1.35rem; padding: 15px 8px; }
    .opt-pic, .pic { font-size: 2.5rem; }
    .letter { width: 46px; height: 52px; font-size: 1.4rem; }
    .slot { width: 40px; height: 50px; font-size: 1.4rem; }
    .game-title { font-size: 1rem; }
}

/* ---------------- AI-written question marker ---------------- */
.ai-badge {
    position: absolute;
    top: 12px;
    inset-inline-end: 14px;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .5px;
    color: #1864ab;
    background: #e7f5ff;
    padding: 4px 10px;
    border-radius: 999px;
    animation: popIn .5s cubic-bezier(.2, .9, .3, 1.5);
}

.game-card { position: relative; }

.q-text.story, bdi.story {
    display: block;
    font-size: clamp(1.15rem, 3.4vw, 1.5rem);
    font-weight: 700;
    color: var(--ink);
    line-height: 1.45;
    max-width: 30ch;
    margin: 0 auto;
}

.story-emoji { font-size: 54px; animation: floaty 3s ease-in-out infinite; }
