/* ==========================================================================
   match3.css - Стили для игры "3 в ряд" в стиле huli
   ========================================================================== */

:root {
    --board-size: min(392px, 92vw);
    --tile-radius: 10px;
    --ease: cubic-bezier(.2, .85, .2, 1);
    --swap-ms: 180ms;
    --fall-ms: 220ms;
    --spawn-ms: 220ms;
    --pop-ms: 260ms;
    --fx-line-ms: 320ms;
    --fx-boom-ms: 420ms;
    --fx-bomb-ms: 540ms;
    --fx-spark-ms: 520ms;
    --fx-create-ms: 520ms;
    --fx-ripple-ms: 520ms;
    
    /* per-type glow palette */
    --t0: 255, 96, 96;
    --t1: 110, 214, 255;
    --t2: 120, 255, 160;
    --t3: 245, 214, 90;
    --t4: 205, 145, 255;
    --t5: 255, 170, 110;
}

/* ===== HERO SECTION ===== */
.trumpamole__match3-hero {
    position: relative;
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    padding-top: var(--safe-top);
    padding-bottom: 22px;
    box-shadow: var(--shadow);
    overflow: visible;
    flex: 0 0 auto;
    background: rgba(0, 0, 0, 0.18);
}

.trumpamole__match3-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url('../../assets/matchthree/bg_page.webp') center/cover no-repeat;
    filter: saturate(1.05) contrast(1.06);
    transform: scale(1.03);
    opacity: .98;
}

.trumpamole__match3-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, .08) 0%,
        rgba(0, 0, 0, .18) 40%,
        rgba(36, 26, 26, .90) 100%);
    pointer-events: none;
}

.trumpamole__match3-hero-inner {
    position: relative;
    z-index: 2;
    width: min(440px, 100%);
    margin: 0 auto;
    padding: calc(12px + var(--safe-top)) 14px 12px 14px;
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 10px;
    align-items: center;
    min-height: 112px;
}

.trumpamole__match3-title-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.trumpamole__match3-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.trumpamole__match3-page-title {
    margin: 0;
    font-size: 14px;
    font-weight: 1000;
    letter-spacing: .35px;
    text-transform: uppercase;
    color: rgba(255, 248, 230, .96);
    text-shadow: 0 12px 26px rgba(0, 0, 0, .42);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trumpamole__match3-stats-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-wrap: nowrap;
}

.trumpamole__match3-chip {
    flex: 1 1 0;
    padding: 10px 10px;
    border-radius: 12px;
    background: rgba(0, 0, 0, .26);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 12px 22px rgba(0, 0, 0, .24);
    border: 1px solid rgba(255, 232, 170, .10);
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.trumpamole__match3-chip-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.trumpamole__match3-chip-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .30));
    opacity: .95;
    flex: 0 0 auto;
}

.trumpamole__match3-chip-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.trumpamole__match3-chip-label {
    font-size: 10px;
    font-weight: 1000;
    text-transform: uppercase;
    letter-spacing: .25px;
    color: rgba(255, 246, 230, .72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trumpamole__match3-chip-value {
    font-size: 13px;
    font-weight: 1000;
    color: rgba(255, 248, 230, .98);
    letter-spacing: .2px;
    white-space: nowrap;
    margin-top: 1px;
}

.trumpamole__match3-goal-line {
    font-size: 12px;
    line-height: 1.25;
    color: rgba(255, 246, 230, .88);
    font-weight: 1000;
    letter-spacing: .15px;
    text-shadow: 0 10px 24px rgba(0, 0, 0, .35);
    display: flex;
    gap: 8px;
    align-items: baseline;
    flex-wrap: wrap;
}

.trumpamole__match3-goal-tag {
    font-size: 10px;
    font-weight: 1000;
    text-transform: uppercase;
    letter-spacing: .35px;
    color: rgba(245, 214, 90, .92);
    background: rgba(0, 0, 0, .18);
    border: 1px solid rgba(245, 214, 90, .14);
    padding: 4px 8px;
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

.trumpamole__match3-goal-val {
    color: rgba(255, 248, 230, .96);
}

.trumpamole__match3-top-icon {
    width: 192px;
    height: 154px;
    display: grid;
    place-items: center;
    overflow: visible;
}

.trumpamole__match3-top-icon img {
    width: 100%;
    height: 100%;
    margin-right: 90px;
    object-fit: contain;
    filter: drop-shadow(0 16px 26px rgba(0, 0, 0, .40));
    transform: translateY(2px);
}

/* ===== TICKETS SECTION ===== */
.trumpamole__match3-tickets-section {
    position: relative;
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 0;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 232, 170, 0.08);
    border-bottom: 1px solid rgba(255, 232, 170, 0.08);
}

.trumpamole__match3-tickets-inner {
    width: min(440px, 100%);
    margin: 0 auto;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.trumpamole__match3-tickets-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trumpamole__match3-tickets-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.22);
    border-radius: 12px;
    border: 1px solid rgba(255, 232, 170, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.trumpamole__match3-tickets-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.3));
}

.trumpamole__match3-tickets-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.trumpamole__match3-tickets-label {
    font-size: 11px;
    font-weight: 800;
    color: rgba(255, 246, 230, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.trumpamole__match3-tickets-value {
    font-size: 18px;
    font-weight: 1000;
    color: rgba(255, 248, 230, 0.98);
    line-height: 1;
}

.trumpamole__match3-tickets-buttons {
    display: flex;
    gap: 8px;
}

/* ===== MAIN PANEL ===== */
.trumpamole__match3-main-panel {
    position: relative;
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    flex: 1 1 auto;
    min-height: 0;
    padding-top: 18px;
    padding-bottom: calc(18px + var(--safe-bottom));
    background: url('../../assets/matchthree/bg_game1.webp') center/cover no-repeat;
    border-top: 1px solid rgba(255, 232, 170, .10);
    overflow: hidden;
}

.trumpamole__match3-main-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(36, 26, 26, .55), rgba(11, 8, 8, .75));
    z-index: 1;
    pointer-events: none;
}

.trumpamole__match3-main-inner {
    position: relative;
    z-index: 2;
    width: min(440px, 100%);
    margin: 0 auto;
    height: 100%;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
}

/* ===== BOARD ===== */
.trumpamole__match3-board {
    width: var(--board-size);
    height: var(--board-size);
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    touch-action: none;
}

.trumpamole__match3-board::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(80% 55% at 50% 0%, rgba(255, 246, 230, .08) 0%, rgba(0, 0, 0, 0) 55%);
    pointer-events: none;
    z-index: 1;
}

.trumpamole__match3-layer {
    position: absolute;
    inset: 0;
    z-index: 2;
}

.trumpamole__match3-fx-layer {
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    overflow: hidden;
}

.trumpamole__match3-mask-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ===== MASK CELLS ===== */
.trumpamole__match3-mask-cell {
    position: absolute;
    width: var(--cell);
    height: var(--cell);
    border-radius: 12px;
    background: rgba(0, 0, 0, .10);
    border: 1px solid rgba(255, 232, 170, .08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
    opacity: .95;
    transition: opacity 200ms var(--ease), filter 200ms var(--ease);
    transform: translateZ(0);
}

.trumpamole__match3-mask-cell.off {
    opacity: .14;
    filter: saturate(.5) blur(.2px);
    background: rgba(0, 0, 0, .25);
    border-color: rgba(255, 232, 170, .05);
}

.trumpamole__match3-mask-cell.ripple {
    animation: trumpamole__ripple-pulse var(--fx-ripple-ms) var(--ease) both;
    animation-delay: calc(var(--d) * 1ms);
}

@keyframes trumpamole__ripple-pulse {
    0% {
        filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0));
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 0 0 rgba(0, 0, 0, 0);
    }
    35% {
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08),
                    0 0 18px rgba(var(--rgb), .22),
                    0 0 44px rgba(var(--rgb), .10);
        background: rgba(var(--rgb), .06);
        border-color: rgba(var(--rgb), .18);
    }
    100% {
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04),
                    0 0 0 rgba(0, 0, 0, 0);
        background: rgba(0, 0, 0, .10);
        border-color: rgba(255, 232, 170, .08);
    }
}

/* ===== TILES ===== */
.trumpamole__match3-tile {
    position: absolute;
    width: var(--cell);
    height: var(--cell);
    border-radius: var(--tile-radius);
    overflow: hidden;
    transform: translate3d(var(--tx), var(--ty), 0);
    transition: transform var(--fall-ms) var(--ease);
    will-change: transform, opacity, filter;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    cursor: pointer;
}

.trumpamole__match3-tile.fast {
    transition-duration: var(--swap-ms);
}

.trumpamole__match3-tile.spawn {
    transition-duration: var(--spawn-ms);
}

.trumpamole__match3-tile.no-trans {
    transition: none !important;
}

.trumpamole__match3-gem {
    position: absolute;
    inset: 1px;
    border-radius: calc(var(--tile-radius) - 4px);
    overflow: hidden;
    transform: translateZ(0);
}

.trumpamole__match3-gem img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .28));
    transform: translateZ(0);
}

.trumpamole__match3-gem::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(50% 45% at 35% 28%, rgba(255, 255, 255, .20), rgba(0, 0, 0, 0) 58%),
                radial-gradient(60% 55% at 55% 65%, rgba(0, 0, 0, .14), rgba(0, 0, 0, 0) 60%);
    opacity: .85;
    pointer-events: none;
}

.trumpamole__match3-tile.sel {
    filter: drop-shadow(0 0 14px rgba(245, 214, 90, .20));
}

.trumpamole__match3-tile.hint {
    animation: trumpamole__hint-pulse 900ms var(--ease) infinite;
    filter: drop-shadow(0 0 16px rgba(245, 214, 90, .35));
}

@keyframes trumpamole__hint-pulse {
    0% { transform: translate3d(var(--tx), var(--ty), 0) scale(1); }
    50% { transform: translate3d(var(--tx), var(--ty), 0) scale(1.06); }
    100% { transform: translate3d(var(--tx), var(--ty), 0) scale(1); }
}

.trumpamole__match3-tile.squash {
    animation: trumpamole__squash 180ms var(--ease) both;
}

@keyframes trumpamole__squash {
    0% { transform: translate3d(var(--tx), var(--ty), 0) scale(1); }
    55% { transform: translate3d(var(--tx), var(--ty), 0) scale(1.08, .94); }
    100% { transform: translate3d(var(--tx), var(--ty), 0) scale(1); }
}

.trumpamole__match3-tile.bad {
    animation: trumpamole__nudge 160ms var(--ease) 0s 2;
}

@keyframes trumpamole__nudge {
    0% { transform: translate3d(var(--tx), var(--ty), 0); }
    50% { transform: translate3d(calc(var(--tx) + 3px), var(--ty), 0); }
    100% { transform: translate3d(var(--tx), var(--ty), 0); }
}

.trumpamole__match3-tile.pop {
    pointer-events: none;
    animation: trumpamole__pop var(--pop-ms) var(--ease) both;
}

@keyframes trumpamole__pop {
    0% { opacity: 1; transform: translate3d(var(--tx), var(--ty), 0) scale(1); }
    45% { opacity: .98; transform: translate3d(var(--tx), var(--ty), 0) scale(1.06); }
    100% { opacity: 0; transform: translate3d(var(--tx), var(--ty), 0) scale(.88); }
}

.trumpamole__match3-tile.created {
    animation: trumpamole__created-pop var(--fx-create-ms) var(--ease) both;
}

@keyframes trumpamole__created-pop {
    0% { filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0)); transform: translate3d(var(--tx), var(--ty), 0) scale(.86); }
    35% { filter: drop-shadow(0 0 18px rgba(255, 248, 230, .18)); transform: translate3d(var(--tx), var(--ty), 0) scale(1.08); }
    100% { filter: drop-shadow(0 0 10px rgba(245, 214, 90, .16)); transform: translate3d(var(--tx), var(--ty), 0) scale(1); }
}

/* ===== FX ELEMENTS ===== */
.trumpamole__match3-fx-line {
    position: absolute;
    border-radius: 999px;
    opacity: .96;
    filter: drop-shadow(0 18px 34px rgba(0, 0, 0, .44));
    mix-blend-mode: screen;
    transform: translateZ(0);
    background: linear-gradient(90deg,
        rgba(var(--rgb), 0) 0%,
        rgba(var(--rgb), .55) 22%,
        rgba(255, 248, 230, .92) 50%,
        rgba(var(--rgb), .55) 78%,
        rgba(var(--rgb), 0) 100%);
}

.trumpamole__match3-fx-line.h {
    height: max(6px, calc(var(--cell) * 0.12));
    width: 120%;
    left: -10%;
    animation: trumpamole__fx-sweep-h var(--fx-line-ms) var(--ease) both;
}

.trumpamole__match3-fx-line.v {
    width: max(6px, calc(var(--cell) * 0.12));
    height: 120%;
    top: -10%;
    animation: trumpamole__fx-sweep-v var(--fx-line-ms) var(--ease) both;
    background: linear-gradient(180deg,
        rgba(var(--rgb), 0) 0%,
        rgba(var(--rgb), .55) 22%,
        rgba(255, 248, 230, .92) 50%,
        rgba(var(--rgb), .55) 78%,
        rgba(var(--rgb), 0) 100%);
}

@keyframes trumpamole__fx-sweep-h {
    0% { opacity: 0; transform: translateX(-10%) scaleX(.75); filter: blur(1px); }
    35% { opacity: 1; transform: translateX(0) scaleX(1); filter: blur(0); }
    100% { opacity: 0; transform: translateX(10%) scaleX(1.1); filter: blur(1px); }
}

@keyframes trumpamole__fx-sweep-v {
    0% { opacity: 0; transform: translateY(-10%) scaleY(.75); filter: blur(1px); }
    35% { opacity: 1; transform: translateY(0) scaleY(1); filter: blur(0); }
    100% { opacity: 0; transform: translateY(10%) scaleY(1.1); filter: blur(1px); }
}

.trumpamole__match3-fx-boom {
    position: absolute;
    width: calc(var(--cell) * 2.6);
    height: calc(var(--cell) * 2.6);
    border-radius: 999px;
    left: calc(var(--x) * 1px);
    top: calc(var(--y) * 1px);
    transform: translate(-50%, -50%) scale(.2);
    opacity: 0;
    mix-blend-mode: screen;
    background: radial-gradient(circle at 50% 50%,
        rgba(255, 248, 230, .92) 0%,
        rgba(var(--rgb), .70) 26%,
        rgba(var(--rgb), .22) 56%,
        rgba(var(--rgb), 0) 72%);
    filter: drop-shadow(0 20px 46px rgba(0, 0, 0, .45));
    animation: trumpamole__fx-boom var(--fx-boom-ms) var(--ease) both;
}

.trumpamole__match3-fx-boom::after {
    content: "";
    position: absolute;
    inset: -10%;
    border-radius: 999px;
    background: radial-gradient(circle at 50% 50%,
        rgba(255, 255, 255, .28) 0%,
        rgba(255, 255, 255, 0) 58%);
    opacity: .72;
    filter: blur(.5px);
}

@keyframes trumpamole__fx-boom {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(.12); }
    35% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.25); }
}

.trumpamole__match3-fx-bomb {
    position: absolute;
    inset: -10%;
    border-radius: 28px;
    mix-blend-mode: screen;
    opacity: 0;
    animation: trumpamole__fx-bomb var(--fx-bomb-ms) var(--ease) both;
    pointer-events: none;
    filter: drop-shadow(0 22px 70px rgba(0, 0, 0, .55));
    background: radial-gradient(60% 60% at 50% 45%,
        rgba(255, 248, 230, .12) 0%,
        rgba(245, 214, 90, .16) 30%,
        rgba(245, 214, 90, .08) 55%,
        rgba(245, 214, 90, 0) 70%);
}

@keyframes trumpamole__fx-bomb {
    0% { opacity: 0; transform: scale(.96); }
    30% { opacity: 1; transform: scale(1.02); }
    100% { opacity: 0; transform: scale(1.08); }
}

.trumpamole__match3-fx-spark {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    left: calc(var(--x) * 1px);
    top: calc(var(--y) * 1px);
    background: rgba(255, 248, 230, .92);
    box-shadow: 0 0 14px rgba(var(--rgb), .55);
    transform: translate(-50%, -50%) translateZ(0);
    opacity: 0;
    animation: trumpamole__fx-spark var(--fx-spark-ms) var(--ease) both;
    mix-blend-mode: screen;
}

@keyframes trumpamole__fx-spark {
    0% { opacity: 0; transform: translate(-50%, -50%) translate(0, 0) scale(.6); }
    12% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) translate(calc(var(--dx) * 1px), calc(var(--dy) * 1px)) scale(.9); }
}

/* ===== CONTROLS ===== */
.trumpamole__match3-controls {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    width: 100%;
    justify-content: center;
}

/* ===== ADAPTIVE ===== */
@media (max-width: 360px) {
    .trumpamole__match3-hero-inner {
        grid-template-columns: 1fr 120px;
    }
    
    .trumpamole__match3-top-icon {
        width: 120px;
        height: 100px;
    }
    
    .trumpamole__match3-top-icon img {
        margin-right: 40px;
    }
}