/* Matek Építkezés 3D */

.me3d-game {
    --ink: #081426;
    --steel: #19314f;
    --glass: rgba(255,255,255,.16);
    --cyan: #00e5ff;
    --blue: #2f80ff;
    --yellow: #ffd166;
    --orange: #ff9f1c;
    --green: #2de6a3;
    --red: #ff3d71;
    position: relative;
    width: min(100%, 1220px);
    height: min(84vh, 790px);
    min-height: 700px;
    margin: 30px auto;
    overflow: hidden;
    border-radius: 38px;
    background:
        radial-gradient(circle at 18% 16%, rgba(255,209,102,.36), transparent 24%),
        radial-gradient(circle at 78% 12%, rgba(0,229,255,.30), transparent 25%),
        linear-gradient(180deg, #6fd8ff 0%, #a7ebff 40%, #d9f6ff 56%, #b59a78 100%);
    box-shadow:
        0 34px 100px rgba(8,20,38,.28),
        inset 0 0 0 1px rgba(255,255,255,.42);
    isolation: isolate;
    color: var(--ink);
    font-family: inherit;
}

.me3d-game * {
    box-sizing: border-box;
}

.me3d-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: manipulation;
}

.me3d-vignette {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 42%, transparent 45%, rgba(8,20,38,.15) 100%),
        linear-gradient(180deg, rgba(255,255,255,.14), transparent 25%, rgba(8,20,38,.12));
    mix-blend-mode: multiply;
}

.me3d-light-sweep {
    position: absolute;
    inset: -120%;
    z-index: 3;
    pointer-events: none;
    background: linear-gradient(115deg, transparent 45%, rgba(255,255,255,.35) 49%, transparent 54%);
    animation: me3dSweep 8s linear infinite;
    opacity: .42;
}

.me3d-hud {
    position: absolute;
    z-index: 9;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: repeat(4, minmax(112px, 1fr));
    gap: 10px;
    width: min(94%, 760px);
    pointer-events: none;
}

.me3d-hud-card {
    padding: 10px 12px;
    border-radius: 22px;
    background: rgba(255,255,255,.24);
    border: 1px solid rgba(255,255,255,.55);
    box-shadow:
        0 14px 32px rgba(8,20,38,.15),
        inset 0 1px 0 rgba(255,255,255,.48);
    backdrop-filter: blur(18px) saturate(1.4);
    text-align: center;
}

.me3d-hud-card span {
    display: block;
    font-size: 11px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: .09em;
    font-weight: 1000;
    color: rgba(8,20,38,.68);
}

.me3d-hud-card strong {
    display: block;
    margin-top: 5px;
    font-size: 22px;
    line-height: 1;
    color: #082746;
    text-shadow: 0 2px 0 rgba(255,255,255,.38);
}

.me3d-question-panel {
    position: absolute;
    z-index: 10;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    width: min(94%, 760px);
    padding: 16px;
    border-radius: 30px;
    background: rgba(255,255,255,.27);
    border: 1px solid rgba(255,255,255,.56);
    box-shadow:
        0 22px 55px rgba(8,20,38,.18),
        inset 0 1px 0 rgba(255,255,255,.5);
    backdrop-filter: blur(22px) saturate(1.5);
}

.me3d-question-panel[hidden] {
    display: none;
}

.me3d-question-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 1000;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: rgba(8,20,38,.66);
}

.me3d-operation {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255,209,102,.25);
}

.me3d-question {
    margin-bottom: 14px;
    font-size: clamp(30px, 5vw, 52px);
    line-height: 1;
    text-align: center;
    font-weight: 1000;
    letter-spacing: -.04em;
    color: #081426;
    text-shadow: 0 3px 0 rgba(255,255,255,.52);
}

.me3d-answers {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.me3d-answer {
    appearance: none;
    border: 0;
    cursor: pointer;
    border-radius: 20px;
    padding: 15px 10px;
    color: #071120;
    background: linear-gradient(145deg, rgba(255,255,255,.78), rgba(255,255,255,.38));
    border: 1px solid rgba(255,255,255,.68);
    box-shadow:
        0 14px 24px rgba(8,20,38,.12),
        inset 0 1px 0 rgba(255,255,255,.7);
    font-size: clamp(20px, 3vw, 32px);
    font-weight: 1000;
    transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}

.me3d-answer:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 20px 34px rgba(8,20,38,.18),
        0 0 0 5px rgba(0,229,255,.12);
}

.me3d-answer.me3d-correct {
    background: linear-gradient(145deg, rgba(45,230,163,.96), rgba(255,255,255,.48));
}

.me3d-answer.me3d-wrong {
    background: linear-gradient(145deg, rgba(255,61,113,.9), rgba(255,255,255,.42));
}

.me3d-toast {
    position: absolute;
    z-index: 18;
    top: 92px;
    left: 50%;
    transform: translateX(-50%);
    min-height: 38px;
    pointer-events: none;
}

.me3d-toast span {
    display: inline-flex;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255,255,255,.34);
    border: 1px solid rgba(255,255,255,.62);
    backdrop-filter: blur(15px);
    box-shadow: 0 16px 34px rgba(8,20,38,.18);
    font-weight: 1000;
    color: #081426;
    animation: me3dToast .95s ease forwards;
}

.me3d-panel {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 50% 32%, rgba(255,255,255,.36), transparent 36%),
        rgba(8,20,38,.06);
    backdrop-filter: blur(8px);
}

.me3d-panel[hidden] {
    display: none;
}

.me3d-card {
    position: relative;
    width: min(95%, 820px);
    padding: clamp(28px, 4.8vw, 56px);
    border-radius: 42px;
    overflow: hidden;
    text-align: center;
    background: linear-gradient(145deg, rgba(255,255,255,.58), rgba(255,255,255,.22));
    border: 1px solid rgba(255,255,255,.62);
    box-shadow:
        0 36px 100px rgba(8,20,38,.25),
        inset 0 1px 0 rgba(255,255,255,.72);
    backdrop-filter: blur(24px) saturate(1.5);
}

.me3d-card:before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(135deg, rgba(255,255,255,.9), rgba(0,229,255,.72), rgba(255,209,102,.78), rgba(255,159,28,.58));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.me3d-card-orbit {
    position: absolute;
    width: 420px;
    height: 420px;
    top: -220px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255,255,255,.72), rgba(0,229,255,.28), transparent 70%);
    filter: blur(5px);
    animation: me3dGlow 3.4s ease-in-out infinite;
}

.me3d-card > *:not(.me3d-card-orbit) {
    position: relative;
    z-index: 1;
}

.me3d-kicker {
    display: inline-flex;
    padding: 8px 15px;
    margin-bottom: 15px;
    border-radius: 999px;
    background: rgba(255,209,102,.28);
    border: 1px solid rgba(255,255,255,.46);
    color: #6d4300;
    font-size: 13px;
    font-weight: 1000;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.me3d-card h2 {
    margin: 0 0 14px;
    font-size: clamp(46px, 7.8vw, 94px);
    line-height: .9;
    letter-spacing: -.055em;
    color: #081426;
    text-shadow:
        0 2px 0 rgba(255,255,255,.72),
        0 14px 38px rgba(8,20,38,.16);
}

.me3d-card h3 {
    margin: 0 0 12px;
    font-size: clamp(36px, 5.4vw, 64px);
    line-height: .95;
    letter-spacing: -.04em;
    color: #081426;
}

.me3d-card p {
    max-width: 660px;
    margin: 0 auto 26px;
    font-size: clamp(16px, 2.1vw, 21px);
    line-height: 1.48;
    font-weight: 760;
    color: rgba(8,20,38,.82);
}

.me3d-feature-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    max-width: 760px;
    margin: 24px auto 30px;
}

.me3d-feature-grid div {
    min-height: 112px;
    padding: 13px 8px;
    border-radius: 26px;
    display: grid;
    place-items: center;
    gap: 5px;
    background: rgba(255,255,255,.27);
    border: 1px solid rgba(255,255,255,.44);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
    transition: transform .18s ease, background .18s ease;
}

.me3d-feature-grid div:hover {
    transform: translateY(-5px) rotate(-1.5deg);
    background: rgba(255,255,255,.38);
}

.me3d-feature-grid b {
    font-size: 34px;
    line-height: 1;
    filter: drop-shadow(0 9px 14px rgba(8,20,38,.12));
}

.me3d-feature-grid span {
    font-size: 11px;
    font-weight: 1000;
    text-transform: uppercase;
    letter-spacing: .045em;
    color: rgba(8,20,38,.70);
}

.me3d-start,
.me3d-restart {
    position: relative;
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 17px 36px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 1000;
    color: #241200;
    background: linear-gradient(135deg, #fff1a6, #ffd166 38%, #ff9f1c 76%, #ff7b00);
    box-shadow:
        0 18px 40px rgba(255,159,28,.38),
        0 0 0 7px rgba(255,255,255,.18),
        inset 0 1px 0 rgba(255,255,255,.72);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
}

.me3d-start:before,
.me3d-restart:before {
    content: "";
    position: absolute;
    inset: -50%;
    background: linear-gradient(115deg, transparent, rgba(255,255,255,.72), transparent);
    transform: translateX(-70%);
    animation: me3dButtonShine 2.5s linear infinite;
}

.me3d-start:hover,
.me3d-restart:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow:
        0 26px 52px rgba(255,159,28,.48),
        0 0 0 9px rgba(255,255,255,.20);
}

.me3d-close {
    position: absolute;
    top: 17px;
    right: 18px;
    z-index: 4;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    background: rgba(255,255,255,.34);
    color: #081426;
    font-size: 30px;
    line-height: 1;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.45);
}

.me3d-result-card {
    width: min(95%, 590px);
}

.me3d-medal {
    font-size: 84px;
    margin-bottom: 10px;
    animation: me3dMedal 1.2s ease-in-out infinite;
}

.me3d-rank {
    margin-bottom: 26px !important;
    color: #08405c !important;
}

.me3d-game.me3d-running .me3d-start-panel {
    display: none;
}

.me3d-game.me3d-hidden {
    display: none;
}

.me3d-game.me3d-shake {
    animation: me3dShake .34s linear;
}

@keyframes me3dSweep {
    from { transform: translateX(-30%) translateY(-30%); }
    to { transform: translateX(30%) translateY(30%); }
}

@keyframes me3dToast {
    0% { opacity: 0; transform: translateY(12px) scale(.9); }
    18% { opacity: 1; transform: translateY(0) scale(1.03); }
    78% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-14px) scale(.96); }
}

@keyframes me3dGlow {
    0%, 100% { opacity: .72; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.12); }
}

@keyframes me3dButtonShine {
    to { transform: translateX(70%); }
}

@keyframes me3dMedal {
    0%, 100% { transform: rotate(-5deg) translateY(0); }
    50% { transform: rotate(6deg) translateY(-8px); }
}

@keyframes me3dShake {
    0%, 100% { transform: translate(0,0); }
    20% { transform: translate(-6px,3px); }
    40% { transform: translate(7px,-3px); }
    60% { transform: translate(-5px,-2px); }
    80% { transform: translate(4px,2px); }
}

@media (max-width: 860px) {
    .me3d-game {
        min-height: 760px;
        height: 84vh;
        border-radius: 26px;
    }

    .me3d-hud {
        top: 10px;
        grid-template-columns: repeat(2, 1fr);
        width: min(94%, 470px);
        gap: 7px;
    }

    .me3d-hud-card {
        padding: 8px 10px;
        border-radius: 18px;
    }

    .me3d-hud-card strong {
        font-size: 18px;
    }

    .me3d-toast {
        top: 112px;
    }

    .me3d-question-panel {
        bottom: 12px;
        padding: 12px;
        border-radius: 24px;
    }

    .me3d-answers {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .me3d-answer {
        border-radius: 17px;
        padding: 13px 8px;
    }

    .me3d-card {
        border-radius: 30px;
        padding: 26px 18px;
    }

    .me3d-card h2 {
        font-size: 48px;
    }

    .me3d-feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .me3d-feature-grid div {
        min-height: 82px;
        border-radius: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .me3d-game *,
    .me3d-game *:before,
    .me3d-game *:after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
