
:root {
    --gmg-trm-accent: var(--gmg-main-accent, #ff3d5a);
    --gmg-trm-accent2: var(--gmg-main-primary, #7c4dff);
    --gmg-trm-ease: cubic-bezier(.2,.8,.2,1);
}


.gmg-tr {
    --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%;
    --h: 46px; --fs: 14px; --dot: 36px;
    position: relative; isolation: isolate;
    display: inline-flex; align-items: center; gap: 10px;
    height: var(--h); padding: 0 18px 0 8px;
    border: 0; border-radius: 999px; cursor: pointer;
    font-family: inherit; font-weight: 600; font-size: var(--fs); line-height: 1; color: #fff;
    background: linear-gradient(120deg, #15151b 0%, #26262f 100%);
    box-shadow: 0 10px 25px -8px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08);
    transform: perspective(600px) rotateX(var(--rx)) rotateY(var(--ry));
    transition: transform .25s var(--gmg-trm-ease), box-shadow .3s, background .3s;
    -webkit-tap-highlight-color: transparent;
    overflow: visible;
}
.gmg-tr {

     color: var(--gmg-main-text, #ffffff);
    background: var(--gmg-main-bg, #000000);

}
.gmg-tr:hover { box-shadow: 0 16px 34px -10px color-mix(in srgb, var(--gmg-trm-accent) 45%, transparent), inset 0 1px 0 rgba(255,255,255,.12); }
.gmg-tr:focus-visible { outline: 3px solid var(--gmg-trm-accent); outline-offset: 4px; }
.gmg-tr:active { transform: perspective(600px) scale(.96); }

.gmg-tr--sm { --h: 36px; --fs: 12px; --dot: 28px; padding-left: 6px; gap: 8px; }
.gmg-tr--lg { --h: 58px; --fs: 16px; --dot: 46px; padding-left: 10px; }
.gmg-tr--shape-square { border-radius: 14px; }
.gmg-tr--shape-square .gmg-tr__ico { border-radius: 10px; }


.gmg-tr[data-theme="light"] { color: #15151b; background: #fff; box-shadow: 0 10px 25px -8px rgba(0,0,0,.2); }
.gmg-tr[data-theme="light"] .gmg-tr__cnt { color: #fff; background: #15151b; }
.gmg-tr[data-theme="accent"], .gmg-tr.is-accent {
    background: linear-gradient(120deg, var(--gmg-trm-accent), var(--gmg-trm-accent2));
    box-shadow: 0 12px 28px -8px color-mix(in srgb, var(--gmg-trm-accent) 55%, transparent);
}


.gmg-tr__ico {
    position: relative; z-index: 2;
    display: grid; place-items: center;
    width: var(--dot); height: var(--dot); border-radius: 50%;
    background: linear-gradient(135deg, var(--gmg-trm-accent), var(--gmg-trm-accent2));
    box-shadow: 0 4px 12px color-mix(in srgb, var(--gmg-trm-accent) 45%, transparent);
    transition: transform .4s var(--gmg-trm-ease);
}
.gmg-tr__ico svg { width: 42%; height: 42%; fill: #fff; margin-left: 12%; transition: transform .3s; }
.gmg-tr:hover .gmg-tr__ico { transform: scale(1.08) rotate(-6deg); }
.gmg-tr:hover .gmg-tr__ico svg { transform: scale(1.1); }

.gmg-tr__txt { position: relative; z-index: 2; white-space: nowrap; letter-spacing: .2px; }
.gmg-tr__cnt {
    position: relative; z-index: 2;
    min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
    display: inline-grid; place-items: center; font-size: 11px;
    background: rgba(255,255,255,.18); backdrop-filter: blur(4px);
}
.gmg-tr.is-icon-only { padding: 0; width: var(--h); justify-content: center; }
.gmg-tr.is-icon-only .gmg-tr__txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }


.gmg-tr__ring {
    position: absolute; inset: -4px; border-radius: inherit; z-index: 0; pointer-events: none;
    background: conic-gradient(from 0deg, transparent 0 70%, var(--gmg-trm-accent) 80%, var(--gmg-trm-accent2) 90%, transparent 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    padding: 2px; opacity: 0; transition: opacity .3s;
}
.gmg-tr.is-ring .gmg-tr__ring { opacity: .9;  }


.gmg-tr.is-pulse .gmg-tr__ico::before, .gmg-tr.is-pulse .gmg-tr__ico::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    border: 2px solid var(--gmg-trm-accent); opacity: 0; z-index: -1;
    animation: gmgTrPulse 2.2s var(--gmg-trm-ease) infinite;
}
.gmg-tr.is-pulse .gmg-tr__ico::after { animation-delay: 1.1s; }


.gmg-tr.is-shine::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 1; pointer-events: none;
    background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.35) 50%, transparent 65%);
    transform: translateX(-120%); transition: none;
}
.gmg-tr.is-shine:hover::before { transform: translateX(120%); transition: transform .9s var(--gmg-trm-ease); }


.gmg-tr::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 0; pointer-events: none;
    background: radial-gradient(circle at var(--mx) var(--my), rgba(255,255,255,.22), transparent 55%);
    opacity: 0; transition: opacity .3s;
}
.gmg-tr:hover::after { opacity: 1; }

@keyframes gmgTrSpin { to { transform: rotate(360deg); } }
@keyframes gmgTrPulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(2.1); opacity: 0; } }


.gmg-tr { animation: gmgTrIn .7s var(--gmg-trm-ease) both; }
@keyframes gmgTrIn { from { opacity: 0; transform: translateY(14px) scale(.9); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }

.gmg-tr-empty { padding: 12px; border: 1px dashed #c4c4cc; border-radius: 10px; color: #777; font-size: 13px; text-align: center; }


.gmg-trm-modal { position: fixed; inset: 0; z-index: 999999; display: none; align-items: center; justify-content: center; padding: 20px; direction: rtl; font-family: inherit; }
.gmg-trm-modal.is-open { display: flex; }
.gmg-trm-modal__veil {
    position: absolute; inset: 0; background: radial-gradient(circle at 50% 40%, rgba(20,20,30,.72), rgba(0,0,0,.92));
    backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2);
    animation: gmgTrFade .35s ease both;
}
.gmg-trm-modal__box {
    position: relative; width: min(960px, 100%); padding: 14px; border-radius: 22px;
    background: rgba(18,18,24,.78); color: #fff;
    border: 1px solid rgba(255,255,255,.1);
    box-shadow: 0 40px 100px -20px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.1);
    animation: gmgTrPop .5s var(--gmg-trm-ease) both;
    overflow: hidden;
}
.gmg-trm-modal__glow {
    position: absolute; width: 420px; height: 420px; top: -180px; inset-inline-end: -140px;
    background: radial-gradient(circle, color-mix(in srgb, var(--gmg-trm-accent) 35%, transparent), transparent 65%);
    pointer-events: none; animation: gmgTrDrift 9s ease-in-out infinite alternate;
}
.gmg-trm-modal__bar { position: relative; display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; }
.gmg-trm-modal__title { flex: 1; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gmg-trm-modal__type {
    font-size: 11px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.12);
}
.gmg-trm-modal__type.is-youtube { background: #c4302b; }
.gmg-trm-modal__type.is-aparat { background: #f08a1c; }
.gmg-trm-modal__type.is-direct { background: linear-gradient(120deg, var(--gmg-trm-accent), var(--gmg-trm-accent2)); }
.gmg-trm-modal__close {
    width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
    background: rgba(255,255,255,.1); color: #fff; transition: transform .3s var(--gmg-trm-ease), background .2s;
}
.gmg-trm-modal__close svg { width: 18px; height: 18px; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; fill: none; }
.gmg-trm-modal__close:hover { background: var(--gmg-trm-accent); transform: rotate(90deg); }

.gmg-trm-modal__stage {
    position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000;
    box-shadow: 0 20px 40px -18px rgba(0,0,0,.8);
}
.gmg-trm-modal__video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
video.gmg-trm-modal__video { object-fit: contain; }
.gmg-trm-modal__video.is-in { animation: gmgTrReveal .6s var(--gmg-trm-ease) both; }
.gmg-trm-modal__video.is-out { animation: gmgTrFade .22s ease reverse both; }
.gmg-trm-modal__err { position: absolute; inset: 0; display: grid; place-items: center; color: #ccc; font-size: 14px; }

.gmg-trm-modal__nav { display: none; align-items: center; gap: 10px; margin-top: 12px; }
.gmg-trm-modal.is-multi .gmg-trm-modal__nav { display: flex; }
.gmg-trm-modal__arrow {
    flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
    background: rgba(255,255,255,.1); display: grid; place-items: center; transition: transform .25s var(--gmg-trm-ease), background .2s;
}
.gmg-trm-modal__arrow svg { width: 20px; height: 20px; stroke: #fff; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.gmg-trm-modal__arrow:hover { background: rgba(255,255,255,.22); }
.gmg-trm-modal__prev:hover { transform: translateX(3px); }
.gmg-trm-modal__next:hover { transform: translateX(-3px); }
.gmg-trm-modal__tabs { flex: 1; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px; }
.gmg-trm-modal__tabs::-webkit-scrollbar { display: none; }
.gmg-trm-modal__tab {
    flex: 0 0 auto; max-width: 220px; padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.14);
    background: transparent; color: #ddd; font-size: 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: all .3s var(--gmg-trm-ease);
}
.gmg-trm-modal__tab:hover { color: #fff; border-color: rgba(255,255,255,.4); }
.gmg-trm-modal__tab.is-active { color: #fff; border-color: transparent; background: linear-gradient(120deg, var(--gmg-trm-accent), var(--gmg-trm-accent2)); box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--gmg-trm-accent) 60%, transparent); transform: translateY(-1px); }


html.gmg-trm-lock { overflow: hidden; padding-inline-end: var(--gmg-trm-sbw, 0px); }


@keyframes gmgTrFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gmgTrPop { from { opacity: 0; transform: translateY(30px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes gmgTrReveal { from { opacity: 0; transform: scale(1.04); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes gmgTrDrift { from { transform: translate(0,0); } to { transform: translate(-60px, 40px); } }


@media (max-width: 640px) {
    .gmg-trm-modal { padding: 10px; }
    .gmg-trm-modal__box { padding: 10px; border-radius: 16px; }
    .gmg-trm-modal__type { display: none; }
    .gmg-trm-modal__nav { gap: 6px; }
    .gmg-trm-modal__arrow { width: 34px; height: 34px; }
}


@media (prefers-reduced-motion: reduce) {
    .gmg-tr.gmg-tr, .gmg-tr.gmg-tr *, .gmg-tr.gmg-tr::before, .gmg-tr.gmg-tr::after,
    .gmg-trm-modal.gmg-trm-modal, .gmg-trm-modal.gmg-trm-modal *, .gmg-trm-modal.gmg-trm-modal *::before {
        animation: none;
        transition: none;
    }
    .gmg-tr.gmg-tr { transform: none; }
    .gmg-tr.gmg-tr:active { transform: none; }
}
