/* Mobile-first native game upgrades */
.game-container { scroll-margin-top: 16px; }
.game-container > h2 { margin-bottom: 18px; }
.game-container .native-game {
    display: block !important;
    overflow: hidden;
    padding: 18px !important;
    border-color: rgba(255, 204, 0, .18) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
}
.game-container .game-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
}
.game-container .game-heading > img {
    width: 86px !important;
    height: 86px !important;
    margin: 0 !important;
    border-radius: 18px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .28);
}
.game-container .game-heading h3 {
    margin: 0 0 4px;
    font-size: clamp(20px, 5.4vw, 25px);
    line-height: 1.2;
}
.game-container .game-desc { margin: 0; }
.game-stage {
    position: relative;
    width: 100%;
    margin: 18px 0 12px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 18px;
    background: radial-gradient(circle at 50% 20%, rgba(255, 204, 0, .10), rgba(3, 12, 18, .5));
    overflow: hidden;
}
.game-status {
    min-height: 26px;
    margin: 10px 8px 2px !important;
    text-align: center;
    font-size: 14px;
}
.game-status strong { color: var(--accent-color) !important; }
.game-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
.btn-game,
.game-container .btn-details {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    min-height: 50px;
    margin: 0 !important;
    padding: 11px 18px;
    border-radius: 14px;
    font: inherit;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.btn-game {
    border: 0;
    background: linear-gradient(135deg, #ffe05b, #ffb800);
    color: #102028;
    box-shadow: 0 8px 18px rgba(255, 190, 0, .2);
}
.btn-game:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn-game:disabled { cursor: wait; opacity: .65; }
.game-container .btn-details {
    border: 1px solid rgba(255, 204, 0, .72);
    background: rgba(255, 204, 0, .04);
}
.btn-game:focus-visible,
.btn-details:focus-visible,
.gem-target:focus-visible,
.card-box:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

/* Spinner */
.spinner-stage { padding: 18px 12px 12px; }
.wheel-wrap {
    position: relative;
    width: min(250px, 76vw);
    aspect-ratio: 1;
    margin: 0 auto;
}
.wheel-pointer {
    position: absolute;
    z-index: 3;
    top: -7px;
    left: 50%;
    width: 0;
    height: 0;
    border-right: 16px solid transparent;
    border-left: 16px solid transparent;
    border-top: 29px solid #fff3aa;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .5));
    transform: translateX(-50%);
}
.lucky-wheel {
    position: absolute;
    inset: 0;
    border: 9px solid #d99c00;
    border-radius: 50%;
    background: conic-gradient(#d94040 0 60deg, #663db8 60deg 120deg, #147c73 120deg 180deg, #dc7928 180deg 240deg, #2269a9 240deg 300deg, #a52e72 300deg 360deg);
    box-shadow: inset 0 0 0 4px #ffe47a, 0 10px 24px rgba(0, 0, 0, .42);
    transition: transform 3.2s cubic-bezier(.12, .62, .12, 1);
}
.lucky-wheel::after {
    content: "D9";
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border: 5px solid #e7aa19;
    border-radius: 50%;
    background: #fff0a1;
    color: #3d2500;
    font-weight: 900;
    transform: translate(-50%, -50%);
}
.lucky-wheel > span {
    position: absolute;
    top: 8%;
    left: 50%;
    width: 52px;
    margin-left: -26px;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    text-align: center;
    text-shadow: 0 1px 3px #000;
    transform: rotate(calc(var(--i) * 60deg + 30deg));
    transform-origin: 26px calc(min(250px, 76vw) * .42);
}

/* Shared stat strip */
.game-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    margin-top: 16px;
}
.game-stats span {
    min-width: 0;
    padding: 8px 4px;
    border-radius: 12px;
    background: rgba(0, 0, 0, .25);
    color: #aebdc4;
    font-size: 12px;
    text-align: center;
}
.game-stats strong {
    display: block;
    color: #fff !important;
    font-size: 20px;
    line-height: 1.2;
}

/* Gem Clicker */
.gem-stage {
    height: 260px;
    min-height: 260px;
    touch-action: manipulation;
}
.gem-target {
    position: absolute;
    top: 0;
    left: 0;
    display: grid;
    width: 74px;
    height: 74px;
    padding: 0;
    place-items: center;
    border: 2px solid rgba(255, 255, 255, .74);
    border-radius: 24px;
    background: radial-gradient(circle at 32% 26%, #c8fbff, #386eea 48%, #491d8d 100%);
    box-shadow: 0 8px 22px rgba(35, 122, 255, .46);
    font-size: 38px;
    cursor: pointer;
    touch-action: manipulation;
    transform: translate(var(--gem-x, 50px), var(--gem-y, 60px)) rotate(var(--gem-rotate, 0));
    transition: transform 100ms ease-out;
}
.gem-target:disabled { filter: grayscale(.5); opacity: .5; cursor: default; }
.gem-target.is-hit span { animation: gem-hit 180ms ease-out; }
.gem-stage .game-status {
    position: absolute;
    right: 8px;
    bottom: 7px;
    left: 8px;
    padding: 5px 8px;
    border-radius: 10px;
    background: rgba(4, 15, 21, .75);
}
@keyframes gem-hit { 50% { transform: scale(1.35); } }

/* Memory Match */
.game-container .memory-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(48px, 1fr)) !important;
    gap: 9px !important;
    width: 100% !important;
    margin: 16px 0 12px !important;
    perspective: 900px;
}
.game-container .card-box {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    padding: 0;
    border: 1px solid rgba(255, 204, 0, .42);
    border-radius: 13px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform .35s ease;
    touch-action: manipulation;
}
.card-box .card-front,
.card-box .card-back {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border-radius: inherit;
    backface-visibility: hidden;
}
.card-box .card-front {
    background: linear-gradient(145deg, #314a58, #162833);
    color: var(--accent-color);
    font-size: 25px;
    font-weight: 900;
}
.card-box .card-back {
    background: linear-gradient(145deg, #fff2aa, #e2aa1e);
    font-size: 29px;
    transform: rotateY(180deg);
}
.card-box.is-open,
.card-box.is-matched { transform: rotateY(180deg); }
.card-box.is-matched .card-back {
    box-shadow: inset 0 0 0 3px #66e0a3, 0 0 14px rgba(66, 220, 145, .35);
}

@media (min-width: 600px) {
    .game-container .native-game { padding: 24px !important; }
    .game-container .game-heading > img { width: 112px !important; height: 112px !important; }
    .game-actions { grid-template-columns: 1.4fr 1fr; }
    .game-container .memory-grid { grid-template-columns: repeat(6, minmax(58px, 1fr)) !important; }
    .gem-stage { height: 300px; }
}
@media (max-width: 380px) {
    .game-container .native-game { padding: 14px !important; }
    .game-container .game-heading > img { width: 72px !important; height: 72px !important; }
    .game-container .game-desc { font-size: 13px; }
    .game-container .memory-grid { gap: 7px !important; }
}
@media (prefers-reduced-motion: reduce) {
    .lucky-wheel,
    .gem-target,
    .card-box { transition-duration: .01ms !important; }
    .gem-target.is-hit span { animation: none; }
}
