/* ============================================================
   Gamepad tester page
   ============================================================ */

.gt-page {
    padding: 8px 0 44px;
}

.gt-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 34px;
    align-items: center;
    padding: 10px 0 34px;
}

.gt-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.gt-eyebrow::before {
    content: "";
    width: 26px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
}

.gt-title {
    margin: 0 0 14px;
    font-size: clamp(2rem, 3.6vw, 3rem);
    line-height: 1.1;
}

.gt-lead {
    max-width: 640px;
    margin: 0 0 22px;
    color: var(--text-soft);
    font-size: 15.5px;
    line-height: 1.65;
}

.gt-status {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 620px;
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.gt-status__dot {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ff4757;
    box-shadow: 0 0 0 5px rgba(255, 71, 87, .12);
    transition: background .2s ease, box-shadow .2s ease;
}

.gt-status.is-connected .gt-status__dot {
    background: #2ed573;
    box-shadow: 0 0 0 5px rgba(46, 213, 115, .14);
}

.gt-status__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.gt-status__text strong {
    font-size: 14px;
}

.gt-status__text span {
    color: var(--muted);
    font-size: 12px;
}

.gt-status__id {
    margin-left: auto;
    max-width: 45%;
    overflow: hidden;
    color: var(--accent);
    font-size: 11.5px;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gt-status__id:empty {
    display: none;
}

.gt-hero__actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.gt-hero__note {
    color: var(--muted);
    font-size: 12px;
}

.gt-hero__img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 22px 50px rgba(10, 25, 50, .16);
}

/* ---------------- Tester layout ---------------- */

.gt-tester {
    padding: 6px 0 30px;
    scroll-margin-top: calc(var(--header-h) + 70px);
}

.gt-tester__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, .8fr);
    gap: 20px;
    align-items: start;
}

.gt-panel {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
}

.gt-panel h2 {
    margin: 0;
    font-size: 17px;
    line-height: 1.3;
}

.gt-panel__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.gt-kicker {
    display: block;
    margin-bottom: 4px;
    color: var(--accent);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.gt-live {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #9fb0c5;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.gt-live i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #38c6ef;
    box-shadow: 0 0 10px rgba(56, 198, 239, .9);
    animation: gt-pulse 1.8s ease-in-out infinite;
}

@keyframes gt-pulse {
    50% { opacity: .35; }
}

.gt-panel--controller {
    overflow: hidden;
    border-color: #26313f;
    background:
        radial-gradient(80% 70% at 50% 20%, rgba(32, 198, 237, .10), transparent 65%),
        radial-gradient(70% 60% at 78% 80%, rgba(124, 58, 237, .12), transparent 70%),
        #10161e;
    color: #fff;
}

.gt-stage {
    position: relative;
    padding: 10px 0 36px;
}

.gt-controller-note {
    position: relative;
    z-index: 4;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 16px;
    margin-top: 4px;
    color: #8fa1b9;
    font-size: 11.5px;
}

.gt-controller-note span:last-child {
    max-width: 64%;
    text-align: right;
}

.gt-controller-note span:first-child {
    color: #38c6ef;
    font-weight: 600;
}

/* ---------------- Xbox gamepad illustration ---------------- */

.xgp {
    position: relative;
    width: 100%;
    max-width: 700px;
    aspect-ratio: 800 / 540;
    margin: 0 auto;
    isolation: isolate;
    user-select: none;
}

.xgp__body {
    position: absolute;
    left: 6%;
    right: 6%;
    top: 15%;
    bottom: 8%;
    border: 1px solid #3b4654;
    border-radius: 44% 44% 32% 32% / 30% 30% 66% 66%;
    background:
        radial-gradient(90% 100% at 50% 0%, #3a434e 0%, #222a33 45%, #171d24 100%);
    box-shadow:
        inset 0 2px 1px rgba(255, 255, 255, .10),
        inset 0 -12px 24px rgba(0, 0, 0, .35),
        0 24px 40px rgba(0, 0, 0, .35);
}

.xgp__body::before,
.xgp__body::after {
    content: "";
    position: absolute;
    bottom: -19%;
    z-index: -1;
    width: 36%;
    height: 68%;
    border: 1px solid #3b4654;
    background: linear-gradient(145deg, #2b333c 0%, #171d24 75%);
    box-shadow: inset -6px -10px 18px rgba(0, 0, 0, .25);
}

.xgp__body::before {
    left: -1%;
    border-radius: 48% 52% 50% 50%;
    transform: rotate(11deg);
}

.xgp__body::after {
    right: -1%;
    border-radius: 52% 48% 50% 50%;
    transform: rotate(-11deg);
}

.xgp__shoulder {
    position: absolute;
    top: 9%;
    z-index: 2;
    display: grid;
    width: 17%;
    height: 7.5%;
    place-items: center;
    border: 1px solid #46515f;
    border-radius: 9px 9px 4px 4px;
    background: linear-gradient(180deg, #303943, #1a2027);
    color: #b9c6d6;
    font-size: clamp(9px, 1.1vw, 12px);
    font-weight: 700;
    letter-spacing: .05em;
    box-shadow: 0 3px 0 rgba(0, 0, 0, .25);
    transition: background .1s ease, border-color .1s ease, color .1s ease, box-shadow .1s ease;
}

.xgp__shoulder.is-pressed {
    border-color: #67d9f7;
    background: linear-gradient(180deg, #2eb8e7, #176f99);
    color: #fff;
    box-shadow: 0 0 20px rgba(56, 198, 239, .6), 0 3px 0 rgba(0, 0, 0, .25);
}

.xgp__shoulder--lb { left: 13%; }
.xgp__shoulder--rb { right: 13%; }

.xgp__trigger {
    position: absolute;
    top: 0;
    z-index: 2;
    display: flex;
    width: 18%;
    height: 10%;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #3b4654;
    border-radius: 7px;
    background: #171d24;
    color: #9fb0c5;
    font-size: clamp(8px, 1vw, 11px);
    font-weight: 700;
}

.xgp__trigger--lt { left: 12.5%; }
.xgp__trigger--rt { right: 12.5%; }

.xgp__trigger.is-pressed {
    border-color: #38c6ef;
    box-shadow: 0 0 18px rgba(56, 198, 239, .45);
}

.xgp__trigger b {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: linear-gradient(90deg, rgba(37, 201, 242, .85), rgba(101, 70, 189, .85));
    transition: width .06s linear;
}

.xgp__trigger span,
.xgp__trigger em {
    position: relative;
    z-index: 1;
}

.xgp__trigger em {
    margin-left: 5px;
    color: #d7e2ef;
    font-size: 9px;
    font-style: normal;
}

.xgp__stick {
    position: absolute;
    z-index: 3;
    display: grid;
    width: clamp(46px, 11%, 78px);
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid #46515f;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #3d4855, #1b222a 68%);
    box-shadow:
        0 0 0 4px #141a20,
        0 8px 16px rgba(0, 0, 0, .45);
    transform: translate(-50%, -50%);
    transition: border-color .12s ease, box-shadow .12s ease;
}

.xgp__stick--left {
    left: 21%;
    top: 41%;
}

.xgp__stick--right {
    left: 68%;
    top: 70%;
}

.xgp__stick-top {
    width: 64%;
    height: 64%;
    border: 1px solid #596675;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 32%, #4b5664, #222a33 70%);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, .08);
    transition: transform .06s linear, box-shadow .12s ease;
}

.xgp__stick.is-active {
    border-color: #38c6ef;
    box-shadow:
        0 0 0 4px #141a20,
        0 0 22px rgba(56, 198, 239, .5),
        0 8px 16px rgba(0, 0, 0, .45);
}

.xgp__stick.is-pressed .xgp__stick-top {
    box-shadow: 0 0 18px rgba(56, 198, 239, .75);
}

.xgp__stick em {
    position: absolute;
    bottom: -19px;
    color: #7f91a6;
    font-size: 9px;
    font-style: normal;
    font-weight: 700;
    letter-spacing: .12em;
}

.xgp__dpad {
    position: absolute;
    left: 21%;
    top: 72%;
    z-index: 3;
    width: clamp(50px, 12%, 78px);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
}

.xgp__dpad span {
    position: absolute;
    border: 1px solid #46515f;
    background: linear-gradient(180deg, #2d353e, #171d24);
    box-shadow: 0 3px 6px rgba(0, 0, 0, .32);
    transition: background .1s ease, border-color .1s ease, box-shadow .1s ease;
}

.xgp__dpad-up,
.xgp__dpad-down {
    left: 35%;
    width: 30%;
    height: 38%;
}

.xgp__dpad-up {
    top: 0;
    border-radius: 4px 4px 0 0;
}

.xgp__dpad-down {
    bottom: 0;
    border-radius: 0 0 4px 4px;
}

.xgp__dpad-left,
.xgp__dpad-right {
    top: 35%;
    width: 38%;
    height: 30%;
}

.xgp__dpad-left {
    left: 0;
    border-radius: 4px 0 0 4px;
}

.xgp__dpad-right {
    right: 0;
    border-radius: 0 4px 4px 0;
}

.xgp__dpad-center {
    top: 35%;
    left: 35%;
    width: 30%;
    height: 30%;
    border-radius: 2px;
    background: #222a33 !important;
}

.xgp__dpad span.is-pressed {
    border-color: #38c6ef;
    background: #1d6f8a !important;
    box-shadow: 0 0 16px rgba(56, 198, 239, .55);
}

.xgp__face {
    position: absolute;
    left: 76%;
    top: 41%;
    z-index: 3;
    width: clamp(104px, 24%, 158px);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
}

.xgp__face-btn {
    position: absolute;
    display: grid;
    width: clamp(28px, 6.3%, 45px);
    aspect-ratio: 1;
    place-items: center;
    border: 2px solid currentColor;
    border-radius: 50%;
    background: rgba(10, 15, 21, .62);
    font-size: clamp(11px, 1.4vw, 16px);
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 4px 8px rgba(0, 0, 0, .3);
    transition: background .1s ease, box-shadow .1s ease, transform .1s ease;
}

.xgp__face-btn--y {
    top: 0;
    left: 50%;
    color: #f4c542;
    transform: translateX(-50%);
}

.xgp__face-btn--b {
    top: 50%;
    right: 0;
    color: #f05b63;
    transform: translateY(-50%);
}

.xgp__face-btn--a {
    bottom: 0;
    left: 50%;
    color: #56cf82;
    transform: translateX(-50%);
}

.xgp__face-btn--x {
    top: 50%;
    left: 0;
    color: #56aef0;
    transform: translateY(-50%);
}

.xgp__face-btn.is-pressed {
    color: #0b1016 !important;
    box-shadow: 0 0 18px currentColor;
}

.xgp__face-btn--y.is-pressed { background: #f4c542; }
.xgp__face-btn--b.is-pressed { background: #f05b63; }
.xgp__face-btn--a.is-pressed { background: #56cf82; }
.xgp__face-btn--x.is-pressed { background: #56aef0; }

.xgp__center {
    position: absolute;
    left: 50%;
    top: 45%;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 14px;
    transform: translate(-50%, -50%);
}

.xgp__guide {
    display: grid;
    width: clamp(30px, 6.4%, 42px);
    aspect-ratio: 1;
    flex: 0 0 auto;
    margin: 0;
    place-items: center;
    border: 1px solid #4a5563;
    border-radius: 50%;
    background: linear-gradient(160deg, #343e49, #171d24);
    color: #d7e2ef;
    font-size: clamp(12px, 1.5vw, 17px);
    font-weight: 800;
    transition: background .1s ease, color .1s ease, box-shadow .1s ease;
}

.xgp__small-btn {
    display: grid;
    width: clamp(22px, 4.6%, 30px);
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid #46515f;
    border-radius: 50%;
    background: #1a2027;
    color: #8fa1b9;
    font-size: 10px;
    transition: background .1s ease, color .1s ease, box-shadow .1s ease;
}

.xgp__small-btn.is-pressed {
    background: #1d6f8a;
    color: #fff;
    box-shadow: 0 0 14px rgba(56, 198, 239, .55);
}

.xgp__guide.is-pressed {
    background: #1f7a39;
    color: #fff;
    box-shadow: 0 0 20px rgba(46, 213, 115, .6);
}

/* ---------------- Readouts ---------------- */

.gt-side {
    display: grid;
    gap: 20px;
}

.gt-side .gt-panel > h2 {
    margin-bottom: 14px;
}

.gt-pill {
    padding: 4px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.gt-pill.is-online {
    border-color: rgba(46, 213, 115, .45);
    color: #1f9d55;
    background: rgba(46, 213, 115, .10);
}

.gt-sticks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.gt-stick-card {
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
}

.gt-stick-card > span {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.gt-stick-card > strong {
    display: block;
    margin: 3px 0 8px;
    font-size: 12px;
    font-weight: 600;
}

.gt-stick-graph {
    position: relative;
    width: 100%;
    aspect-ratio: 1.9;
    border: 1px solid var(--border);
    border-radius: 6px;
    background:
        linear-gradient(var(--border) 1px, transparent 1px) 0 50% / 100% 50% no-repeat,
        linear-gradient(90deg, var(--border) 1px, transparent 1px) 50% 0 / 50% 100% no-repeat,
        var(--surface);
}

.gt-stick-graph::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    border: 1px solid var(--muted);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: .5;
}

.gt-stick-graph i {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #38c6ef;
    box-shadow: 0 0 12px rgba(56, 198, 239, .65);
    transform: translate(-50%, -50%);
    transition: transform .06s linear;
}

.gt-trigger-list {
    display: grid;
    gap: 9px;
    margin-bottom: 15px;
}

.gt-trigger-row {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) 38px;
    align-items: center;
    gap: 10px;
    color: var(--text-soft);
    font-size: 11.5px;
}

.gt-trigger-row > span {
    font-weight: 700;
}

.gt-trigger-row > b {
    text-align: right;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.gt-bar {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-3);
}

.gt-bar i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #25c9f2, #6546bd);
    transition: width .06s linear;
}

.gt-pressed {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
}

.gt-pressed > span {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 11px;
}

.gt-pressed code {
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.gt-raw {
    display: grid;
    gap: 7px;
    margin-top: 12px;
    padding: 11px;
    border-radius: 6px;
    background: #121821;
    color: #9fb0c5;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 10.5px;
}

.gt-raw div {
    display: flex;
    gap: 8px;
}

.gt-raw span {
    flex: 0 0 52px;
    color: #5f7590;
}

.gt-raw code {
    overflow-wrap: anywhere;
}

.gt-muted {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.gt-range {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    color: var(--text-soft);
    font-size: 12px;
}

.gt-range input {
    width: 100%;
    accent-color: var(--accent);
}

.gt-range b {
    text-align: right;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.gt-vibrate {
    width: 100%;
    margin-top: 16px;
}

.gt-vibration-note {
    margin-top: 9px;
}

/* ---------------- Help ---------------- */

.gt-help {
    padding: 10px 0 0;
}

.gt-help__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
}

.gt-help h2,
.gt-help h3 {
    margin: 0 0 12px;
    font-size: 17px;
}

.gt-help ol,
.gt-help ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-soft);
    font-size: 13.5px;
    line-height: 1.65;
}

.gt-help li {
    margin-bottom: 7px;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 1100px) {
    .gt-hero {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .gt-hero__img {
        max-width: 820px;
    }

    .gt-tester__grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .gt-page {
        padding-bottom: 26px;
    }

    .gt-title {
        font-size: 1.8rem;
    }

    .gt-status {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .gt-status__id {
        max-width: 100%;
        margin-left: 28px;
        text-align: left;
    }

    .gt-panel {
        padding: 14px;
    }

    .gt-sticks {
        grid-template-columns: 1fr;
    }

    .gt-help__grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 18px;
    }

    .gt-range {
        grid-template-columns: 82px minmax(0, 1fr) 30px;
    }

    .xgp__stick em {
        display: none;
    }
}
