
:root {
    --bg1: #5a41d9;
    --bg2: #7d6cff;
    --bg3: #38bdf8;
    --bg4: #f472b6;
    --panel: rgba(255, 255, 255, 0.16);
    --panel-strong: rgba(255, 255, 255, 0.22);
    --card-light: #fffdf8;
    --card-soft: #fff6d9;
    --text-dark: #334155;
    --text-soft: #64748b;
    --pink: #ff7ac6;
    --pink-dark: #db2777;
    --blue: #4f46e5;
    --sky: #38bdf8;
    --green: #22c55e;
    --green-dark: #16a34a;
    --yellow: #fbbf24;
    --orange: #fb923c;
    --red: #ef4444;
    --shadow: 0 28px 70px rgba(35, 23, 100, 0.28);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Nunito', sans-serif;
    color: #fff;
    background:
        radial-gradient(circle at 15% 12%, rgba(255, 255, 255, 0.18), transparent 0 12%),
        radial-gradient(circle at 82% 18%, rgba(255, 244, 181, 0.28), transparent 0 16%),
        radial-gradient(circle at 50% 90%, rgba(244, 114, 182, 0.2), transparent 0 18%),
        linear-gradient(135deg, var(--bg1), var(--bg2) 42%, var(--bg3) 78%, #60a5fa);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

body::before,
body::after {
    content: '';
    position: fixed;
    pointer-events: none;
    z-index: 0;
    opacity: .22;
    border-radius: 999px;
    filter: blur(24px);
}
body::before {
    width: 420px;
    height: 420px;
    left: -120px;
    bottom: -120px;
    background: #fde68a;
}
body::after {
    width: 380px;
    height: 380px;
    right: -80px;
    top: 40px;
    background: #f9a8d4;
}

button { font: inherit; }
img { max-width: 100%; display: block; }
.hidden, .game-hidden { display: none !important; }

.bg-orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(18px);
    opacity: .48;
    pointer-events: none;
}
.orb-1 { width: 220px; height: 220px; background: #ffd166; left: 22px; top: 32px; }
.orb-2 { width: 360px; height: 360px; background: #93c5fd; right: -60px; top: 180px; }
.orb-3 { width: 260px; height: 260px; background: #f9a8d4; left: 18%; bottom: -70px; }

.intro-screen,
.game-container {
    width: min(1280px, calc(100% - 40px));
    margin: auto;
    position: relative;
    z-index: 1;
}

.intro-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
    gap: 24px;
    align-items: center;
    background:
        radial-gradient(circle at top right, rgba(255,255,255,.18), transparent 24%),
        linear-gradient(135deg, rgba(74, 37, 194, .96), rgba(98, 59, 222, .94) 45%, rgba(37, 156, 240, .9));
    border-radius: 40px;
    padding: 34px;
    min-height: min(860px, calc(100vh - 48px));
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06) inset, 0 40px 90px rgba(0,0,0,0.34);
    border: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(18px);
    overflow: hidden;
    position: relative;
}

.intro-card::before,
.game-container::before {
    content: '';
    position: absolute;
    inset: 14px;
    border-radius: 30px;
    border: 2px dashed rgba(255,255,255,0.12);
    pointer-events: none;
}

.intro-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100%;
    position: relative;
    z-index: 1;
}
.intro-badge, .story-tag, .step-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 10px 18px;
    font-weight: 900;
    letter-spacing: .01em;
}
.intro-badge {
    align-self: flex-start;
    background: rgba(255,255,255,.16);
    color: #fff8bf;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.story-tag {
    background: #fef3c7;
    color: #9a3412;
}
.step-badge {
    background: #dbeafe;
    color: #1d4ed8;
}
.intro-copy h1, .question-box h2 {
    font-family: 'Fredoka', sans-serif;
    line-height: 1.05;
    margin: 18px 0 14px;
    letter-spacing: .01em;
}
.intro-copy h1 {
    font-size: clamp(2.5rem, 4.3vw, 4.3rem);
    text-shadow: 0 4px 18px rgba(0,0,0,.14);
}
.intro-copy p {
    font-size: 1.22rem;
    line-height: 1.65;
    margin: 0 0 14px;
    max-width: 720px;
    color: rgba(255,255,255,.96);
}
.intro-actions {
    display: flex;
    gap: 14px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.intro-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    z-index: 1;
}
.intro-mascot-glow {
    position: absolute;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.56), rgba(255,255,255,0));
}
.intro-art {
   /* width: min(430px, 100%);
    max-width: 100%; */
	width: 150% !important;
    max-width: 150% !important;
    height: clamp(320px, 30vw, 420px);
    object-fit: contain;
    animation: floaty 3.8s ease-in-out infinite;
    filter: drop-shadow(0 18px 40px rgba(46, 29, 128, 0.28));
}

.btn-action, .btn-secondary {
    border: 0;
    border-radius: 18px;
    padding: 14px 24px;
    cursor: pointer;
    font-weight: 900;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease, filter .18s ease;
}
.btn-action:hover, .btn-secondary:hover, .answer-option:hover, .memory-card:hover {
    transform: translateY(-2px) scale(1.01);
}
.btn-action {
    background: linear-gradient(180deg, #ffe27a, #ffb648);
    color: #7c2d12;
    box-shadow: 0 14px 24px rgba(251, 146, 60, .35);
}
.btn-secondary {
    background: rgba(255,255,255,.16);
   /* color: #fff; */
   color: #1d4ed8;
    border: 1px solid rgba(255,255,255,.14);
    box-shadow: 0 10px 20px rgba(38, 26, 110, .14);
}
.btn-large { font-size: 1.04rem; }
.btn-listen { padding-inline: 16px; }

.game-container {
    background:
        linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.06)),
        rgba(33, 27, 92, .62);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 34px;
    padding: 24px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
    position: relative;
}

.game-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    align-items: center;
}
.player-info {
    display: flex;
    gap: 16px;
    align-items: center;
    min-width: 0;
}
.avatar-wrap {
    width: 86px;
    height: 86px;
    border-radius: 26px;
    background: linear-gradient(180deg, #ffffff, #eef4ff);
    display: grid;
    place-items: center;
    box-shadow: 0 14px 28px rgba(25, 40, 120, 0.18);
    flex-shrink: 0;
}
.avatar-image {
    width: 58px;
    height: 58px;
    object-fit: contain;
}
.player-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.player-name {
    font-family: 'Fredoka', sans-serif;
    font-size: clamp(1.35rem, 2vw, 2rem);
    font-weight: 700;
}
.player-subtitle {
    color: rgba(255,255,255,.88);
    font-weight: 700;
}

.header-right,
.phase-box {
    display: flex;
    align-items: center;
    gap: 14px;
}
.phase-box {
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 24px;
    padding: 14px 18px;
    min-width: 220px;
}
.phase-stars {
    font-size: 1.35rem;
    color: #fcd34d;
    letter-spacing: 2px;
}
.phase-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 130px;
}
.phase-copy span {
    font-weight: 800;
}
.phase-bar,
.phase-progress-line {
    width: 100%;
    height: 12px;
    background: rgba(255,255,255,.18);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 2px 6px rgba(0,0,0,.12);
}
.phase-bar-fill,
.screen-progress-fill {
    height: 100%;
    border-radius: inherit;
    /* background: linear-gradient(90deg, #fbbf24, #fb7185, #60a5fa, #22c55e); */
	background: linear-gradient(90deg, #22c55e, #60a5fa); 
    box-shadow: 0 4px 12px rgba(255,255,255,.3);
    transition: width .35s ease;
}

.game-layout {
    display: grid;
    grid-template-columns: minmax(420px, 1fr) minmax(360px, 430px);
    gap: 22px;
    align-items: stretch;
}
.visual-panel,
.card-challenge {
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(247, 248, 255, .96));
    border-radius: 30px;
    box-shadow: 0 20px 42px rgba(27, 27, 70, 0.16);
    border: 1px solid rgba(188, 205, 255, 0.5);
    color: var(--text-dark);
}
.visual-panel {
    padding: 20px;
    min-height: 660px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.card-challenge {
    padding: 22px;
    display: flex;
    flex-direction: column;
    min-height: 660px;
	height: 100%;
}
.panel-top,
.card-header,
.challenge-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-header {
    margin-bottom: 18px;
}
.score-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, #fff7d1, #ffe38a);
    color: #92400e;
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 900;
    box-shadow: 0 10px 16px rgba(251, 191, 36, .2);
}
.coin {
    font-size: 1.15rem;
}
.question-box {
    background: #ffffff;
    border-radius: 24px;
    padding: 20px;
    box-shadow: inset 0 0 0 1px #e2e8f0;
}
.question-box h2 {
    color: #4338ca;
    font-size: clamp(1.7rem, 2vw, 2.2rem);
}
.question-text p {
    margin: 0 0 12px;
    color: var(--text-soft);
    font-size: 1.05rem;
    line-height: 1.65;
}
.question-text p:last-child {
    margin-bottom: 0;
}

.visual-box,
.interaction-area {
    flex: 1;
}
.visual-box {
    display: flex;
    justify-content: center;
    align-items: center;
    background:
        radial-gradient(circle at top left, #ffffff, #eff6ff 42%, #eef2ff);
    border-radius: 28px;
    border: 2px dashed #dbeafe;
    padding: 18px;
    min-height: 560px;
}
.story-illustration {
    width: 100%;
    max-width: 760px;
    max-height: 500px;
    object-fit: contain;
    animation: floatySmall 4s ease-in-out infinite;
}
.screen-caption {
    position: absolute;
    left: 22px;
    bottom: 20px;
    background: rgba(255,255,255,.92);
    color: #475569;
    padding: 10px 14px;
    border-radius: 16px;
    font-weight: 800;
    box-shadow: 0 8px 22px rgba(148, 163, 184, .18);
}
.visual-panel .visual-box {
    position: relative;
}

.interaction-area {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.instructions-note,
.final-box,
.instructions-visual {
    background: linear-gradient(180deg, #ffffff, #fffaf0);
    border: 1px solid #fde7c8;
    border-radius: 24px;
    padding: 18px;
    color: var(--text-dark);
    text-align: center;
    box-shadow: 0 14px 28px rgba(251, 191, 36, .08);
}
.instructions-note {
    font-size: 1.06rem;
    line-height: 1.65;
    font-weight: 700;
    color: #475569;
}
.instructions-visual img,
.final-box img {
    width: 100%;
    max-width: 420px;
    margin: 0 auto 14px;
}
.final-box p {
    margin: 0;
    color: #475569;
    font-size: 1.06rem;
    line-height: 1.6;
    font-weight: 700;
}

.memory-hud {
    display: grid;
    gap: 12px;
}
.pairs-counter {
    text-align: center;
    background: linear-gradient(180deg, #eef7ff, #ffffff);
    border-radius: 18px;
    padding: 12px 16px;
    color: #1e40af;
    font-weight: 900;
    border: 1px solid #bfdbfe;
}
.memory-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.memory-card {
    border: 0;
    background: transparent;
    perspective: 1000px;
    min-height: 168px;
    padding: 0;
    position: relative;
}
.memory-card-inner {
    position: relative;
    display: block;
   /* width: 100%; */
    width: 90%;
    height: 100%;
    min-height: 168px;
    transform-style: preserve-3d;
    transition: transform .5s ease;
}
.memory-card.flipped .memory-card-inner,
.memory-card.matched .memory-card-inner {
    transform: rotateY(180deg) scale(1.01);
}
.memory-card-face {
    position: absolute;
    inset: 0;
    border-radius: 22px;
    overflow: hidden;
    backface-visibility: hidden;
    box-shadow: 0 14px 28px rgba(67, 56, 202, 0.14);
}
.memory-card-back {
    /* background: linear-gradient(180deg, #7c3aed, #38bdf8); */
    display: grid;
    place-items: center;
}
.memory-card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
	cursor: pointer;
}
.memory-card-front {
    transform: rotateY(180deg);
    /* background: linear-gradient(180deg, #fffef8, #ffffff); */
    border: 2px solid #dbeafe;
   /* padding: 10px; */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.memory-card-front img {
    width: 100%;
    height: 118px;
    object-fit: contain;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
}
.card-label {
    display: block;
    margin-top: 10px;
    padding: 10px 8px 8px;
    text-align: center;
    font-family: 'Fredoka', sans-serif;
    color: #4338ca;
    font-size: .98rem;
    line-height: 1.15;
}
.memory-card.matched .memory-card-front {
    background: linear-gradient(180deg, #ecfdf5, #f0fdf4);
    border-color: #86efac;
}
.memory-card.disabled {
    pointer-events: none;
    filter: saturate(1.05);
}
.memory-card.pop .memory-card-inner {
    animation: popCard .45s ease;
}
.memory-card.shake .memory-card-inner {
    animation: shakeCard .38s ease;
}

.challenge-actions {
    margin-top: auto;
    padding-top: 18px;
}
.challenge-actions .btn-action {
    min-width: 160px;
    margin-left: auto;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(19, 16, 57, 0.56);
    display: grid;
    place-items: center;
    padding: 20px;
}
.modal-card {
    width: min(560px, 100%);
    background: linear-gradient(180deg, #ffffff, #fffdf8);
    border-radius: 30px;
    padding: 28px 24px;
    color: var(--text-dark);
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.2);
    position: relative;
    text-align: center;
}
.modal-card-wide {
    width: min(720px, 100%);
}
.modal-card-feedback {
    width: min(520px, 100%);
}
.modal-close {
    position: absolute;
    right: 16px;
    top: 14px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 0;
    background: #eef2ff;
    color: #475569;
    cursor: pointer;
    font-weight: 900;
}
.modal-card h2 {
    margin: 10px 0 14px;
    font-family: 'Fredoka', sans-serif;
    color: #4338ca;
    font-size: 2rem;
}
.modal-card p {
    color: #64748b;
    line-height: 1.65;
}
.modal-icon {
    width: 82px;
    height: 82px;
    border-radius: 999px;
    margin: 0 auto;
    display: grid;
    place-items: center;
    font-size: 2rem;
    box-shadow: 0 14px 28px rgba(59, 130, 246, .14);
}
.modal-icon-book {
    background: linear-gradient(180deg, #dbeafe, #eef2ff);
}
.modal-icon-feedback-positive {
    background: linear-gradient(180deg, #dcfce7, #f0fdf4);
}
.modal-icon-feedback-negative {
    background: linear-gradient(180deg, #fef3c7, #fff7ed);
}
.instructions-list {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}
.instruction-item {
    display: grid;
    grid-template-columns: 54px 1fr;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 20px;
    background: linear-gradient(180deg, #f8fbff, #ffffff);
    border: 1px solid #e2e8f0;
    text-align: left;
}
.instruction-item span {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffe27a, #ffb648);
    color: #7c2d12;
    display: grid;
    place-items: center;
    font-weight: 900;
}
.instruction-item p {
    margin: 0;
    font-weight: 700;
    color: #475569;
}
.modal-action {
    margin-top: 10px;
}

@keyframes floaty {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}
@keyframes floatySmall {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@keyframes popCard {
    0% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.08); }
    100% { transform: rotateY(180deg) scale(1.01); }
}
@keyframes shakeCard {
    0%, 100% { transform: rotateY(180deg) translateX(0); }
    25% { transform: rotateY(180deg) translateX(-6px); }
    75% { transform: rotateY(180deg) translateX(6px); }
}

@media (max-width: 1100px) {
    body {
        display: block;
        padding: 22px 0;
    }
    .intro-card,
    .game-layout {
        grid-template-columns: 1fr;
    }
    .visual-panel,
    .card-challenge {
        min-height: auto;
    }
    .visual-box {
        min-height: 360px;
    }
}

@media (max-width: 760px) {
    .intro-screen,
    .game-container {
        width: min(100%, calc(100% - 20px));
    }
    .intro-card,
    .game-container {
        padding: 16px;
        border-radius: 24px;
    }
    .game-header {
        flex-direction: column;
        align-items: stretch;
    }
    .phase-box {
        min-width: 0;
        width: 100%;
    }
    .memory-board {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .memory-card,
    .memory-card-inner {
        min-height: 150px;
    }
    .memory-card-front img {
        height: 96px;
    }
    .question-box h2 {
        font-size: 1.55rem;
    }
}

@media (max-width: 520px) {
    .intro-copy p {
        font-size: 1.02rem;
    }
    .memory-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .memory-card,
    .memory-card-inner {
        min-height: 140px;
    }
    .memory-card-front img {
        height: 86px;
    }
    .card-label {
        font-size: .9rem;
    }
}


.visual-box-memory {
    align-items: flex-start;
    padding: 36px 22px 22px;
}

.visual-box-memory .memory-board {
    width: 100%;
}

.visual-box-memory .memory-card {
    min-height: 196px;
}

.visual-box-memory .memory-card-inner {
    min-height: 196px;
}

.visual-box-memory .memory-card-front img {
    /* height: 136px; */
    height: 100%;
}

/* Ajsutes */

.interaction-area:empty {
    display: none;
}

.screen-caption {
    display: none;
}

div#interactionArea {
    display: none;
}

span.card-label {
    display: none;
}