:root {
    color-scheme: dark;
    --bg: #070a08;
    --surface: #101611;
    --surface-2: #151d17;
    --surface-3: #1b271f;
    --line: #2b3a30;
    --text: #edf8ef;
    --muted: #aab8ad;
    --soft: #7e9083;
    --green: #42d66f;
    --green-2: #14954a;
    --cyan: #49c8d9;
    --amber: #f4b84a;
    --red: #ff6973;
    --focus: #d8ff7a;
    --shadow: 0 18px 55px rgba(0, 0, 0, 0.42);
    --radius: 8px;
    --max-width: 1180px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(66, 214, 111, 0.16), transparent 28rem),
        linear-gradient(180deg, #070a08 0%, #0c120e 48%, #070a08 100%);
    color: var(--text);
}

body.modal-open {
    overflow: hidden;
}

a {
    color: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.skip-link,
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link:focus {
    width: auto;
    height: auto;
    margin: 0;
    clip: auto;
    padding: 0.75rem 1rem;
    top: 1rem;
    left: 1rem;
    z-index: 100;
    background: var(--green);
    color: #071006;
    border-radius: var(--radius);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid rgba(66, 214, 111, 0.18);
    background: rgba(7, 10, 8, 0.9);
    backdrop-filter: blur(18px);
}

.nav-shell,
.site-footer,
main > section,
main > div > section {
    width: min(var(--max-width), calc(100% - 2rem));
    margin-inline: auto;
}

.nav-shell {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    min-width: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green), var(--cyan));
    color: #071006;
    font-weight: 900;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    line-height: 1.1;
}

.brand small {
    color: var(--muted);
    margin-top: 0.2rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links a,
.button,
.nav-toggle {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 0.72rem 0.95rem;
    color: var(--text);
    text-decoration: none;
    line-height: 1;
    cursor: pointer;
}

.nav-links a {
    color: var(--muted);
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.button-primary {
    border-color: rgba(66, 214, 111, 0.55);
    background: linear-gradient(135deg, var(--green), var(--green-2));
    color: #041006;
    font-weight: 800;
}

.button-secondary {
    border-color: rgba(73, 200, 217, 0.48);
    background: rgba(73, 200, 217, 0.1);
    color: var(--text);
}

.button-ghost {
    border-color: rgba(66, 214, 111, 0.35);
    background: rgba(66, 214, 111, 0.08);
}

.button:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.full-width {
    width: 100%;
}

.nav-toggle {
    display: none;
    background: var(--surface-2);
    border-color: var(--line);
}

.dashboard-hero,
.model-hero {
    min-height: calc(100vh - 92px);
    display: grid;
    align-items: center;
    gap: 2rem;
    padding: 3rem 0;
}

.dashboard-hero {
    grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.92fr);
}

.model-hero {
    min-height: 380px;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.85fr);
}

.hero-copy h1,
.model-hero h1,
.legal-page h1 {
    max-width: 820px;
    margin: 0;
    font-size: clamp(2.1rem, 4vw, 4.8rem);
    line-height: 1.04;
    letter-spacing: 0;
}

.model-hero h1 {
    font-size: clamp(2.2rem, 4vw, 4.4rem);
}

.hero-copy p:not(.eyebrow),
.model-hero p:not(.eyebrow),
.legal-page > p {
    max-width: 760px;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.7;
}

.eyebrow {
    margin: 0 0 0.65rem;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 0;
    font-size: 0.78rem;
    font-weight: 800;
}

.hero-actions,
.toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.hero-instrument {
    min-height: 420px;
    border: 1px solid rgba(66, 214, 111, 0.22);
    border-radius: var(--radius);
    background:
        linear-gradient(145deg, rgba(66, 214, 111, 0.08), rgba(73, 200, 217, 0.09)),
        var(--surface);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    display: grid;
    align-content: center;
    gap: 1rem;
}

.instrument-ring {
    width: min(100%, 310px);
    aspect-ratio: 1;
    margin: 0 auto;
    border-radius: 50%;
    display: grid;
    place-items: center;
    text-align: center;
    border: 22px solid rgba(66, 214, 111, 0.25);
    box-shadow: inset 0 0 0 2px rgba(73, 200, 217, 0.18);
}

.instrument-ring span,
.instrument-ring strong {
    display: block;
}

.instrument-ring span {
    color: var(--muted);
}

.instrument-ring strong {
    font-size: 2rem;
}

.instrument-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.instrument-list span {
    min-height: 52px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    text-align: center;
    padding: 0.75rem;
}

.tester-shell,
.section-block,
.legal-page {
    margin-block: 2rem;
}

.tester-shell {
    border: 1px solid rgba(66, 214, 111, 0.2);
    border-radius: var(--radius);
    background: rgba(16, 22, 17, 0.92);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.tester-toolbar,
.section-heading,
.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.tester-toolbar {
    padding: 1.25rem;
    border-bottom: 1px solid var(--line);
}

.tester-toolbar h2,
.section-heading h2,
.panel-heading h3 {
    margin: 0;
    letter-spacing: 0;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-bottom: 1px solid var(--line);
}

.status-card {
    padding: 1rem 1.25rem;
    border-right: 1px solid var(--line);
    min-width: 0;
}

.status-card:last-child {
    border-right: 0;
}

.status-card span,
.pix-box span,
.model-specs dt {
    display: block;
    color: var(--soft);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0;
    margin-bottom: 0.35rem;
}

.status-card strong,
.model-specs dd {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
}

.tester-grid {
    display: grid;
    grid-template-columns: minmax(300px, 0.95fr) minmax(320px, 1.05fr);
    gap: 0;
}

.controller-visual-panel,
.metrics-panel {
    padding: 1.25rem;
}

.controller-visual-panel {
    border-right: 1px solid var(--line);
}

.controller-visual {
    min-height: 430px;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.controller-body {
    position: relative;
    width: min(100%, 560px);
    aspect-ratio: 1.32;
    border-radius: 34% 34% 42% 42%;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
        #17221b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        inset 0 -28px 55px rgba(0, 0, 0, 0.22),
        0 30px 70px rgba(0, 0, 0, 0.35);
}

.controller-body::before,
.controller-body::after {
    content: "";
    position: absolute;
    width: 34%;
    height: 56%;
    bottom: -7%;
    background: #131d16;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: -1;
}

.controller-body::before {
    left: -9%;
    border-radius: 55% 32% 55% 52%;
    transform: rotate(18deg);
}

.controller-body::after {
    right: -9%;
    border-radius: 32% 55% 52% 55%;
    transform: rotate(-18deg);
}

.trigger,
.bumper,
.dpad span,
.face-buttons span,
.center-buttons span {
    position: absolute;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #233028;
    color: var(--text);
    transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
    user-select: none;
}

.trigger {
    top: -12%;
    width: 23%;
    height: 15%;
    border-radius: var(--radius);
}

.trigger-left {
    left: 12%;
}

.trigger-right {
    right: 12%;
}

.bumper {
    top: 2%;
    width: 26%;
    height: 12%;
    border-radius: var(--radius);
}

.bumper-left {
    left: 10%;
}

.bumper-right {
    right: 10%;
}

.stick {
    position: absolute;
    width: 24%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #0b100d;
    border: 1px solid rgba(255, 255, 255, 0.16);
    display: grid;
    place-items: center;
}

.stick-left {
    left: 17%;
    top: 34%;
}

.stick-right {
    right: 26%;
    bottom: 17%;
}

.stick-knob {
    width: 62%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: linear-gradient(145deg, #445348, #111914);
    border: 1px solid rgba(255, 255, 255, 0.16);
    transition: transform 80ms linear;
}

.stick small {
    position: absolute;
    bottom: -1.4rem;
    color: var(--soft);
}

.dpad {
    position: absolute;
    left: 21%;
    bottom: 17%;
    width: 24%;
    aspect-ratio: 1;
}

.dpad span {
    width: 34%;
    height: 34%;
    border-radius: var(--radius);
}

.dpad span:nth-child(1) {
    top: 0;
    left: 33%;
}

.dpad span:nth-child(2) {
    left: 0;
    top: 33%;
}

.dpad span:nth-child(3) {
    right: 0;
    top: 33%;
}

.dpad span:nth-child(4) {
    left: 33%;
    bottom: 0;
}

.face-buttons {
    position: absolute;
    right: 13%;
    top: 31%;
    width: 27%;
    aspect-ratio: 1;
}

.face-buttons span {
    width: 34%;
    aspect-ratio: 1;
    border-radius: 50%;
    font-weight: 900;
}

.btn-y {
    top: 0;
    left: 33%;
}

.btn-x {
    left: 0;
    top: 33%;
}

.btn-b {
    right: 0;
    top: 33%;
}

.btn-a {
    left: 33%;
    bottom: 0;
}

.center-buttons {
    position: absolute;
    left: 37%;
    top: 36%;
    width: 26%;
    height: 20%;
}

.center-buttons span {
    min-width: 42px;
    min-height: 34px;
    padding: 0 0.4rem;
    border-radius: var(--radius);
    font-size: 0.72rem;
}

.center-buttons span:nth-child(1) {
    left: 0;
    top: 34%;
}

.center-buttons span:nth-child(2) {
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    border-radius: 50%;
    width: 42px;
    height: 42px;
}

.center-buttons span:nth-child(3) {
    right: 0;
    top: 34%;
}

[data-control].is-active,
.button-meter.is-active,
.axis-meter.is-active {
    background: rgba(66, 214, 111, 0.24);
    border-color: rgba(66, 214, 111, 0.85);
    box-shadow: 0 0 22px rgba(66, 214, 111, 0.3);
}

[data-control].is-active {
    transform: translateY(2px) scale(0.98);
}

.metrics-panel {
    display: grid;
    align-content: start;
    gap: 1rem;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
}

.button-meter,
.axis-meter {
    min-height: 58px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
    padding: 0.72rem;
    position: relative;
    overflow: hidden;
}

.button-meter::before,
.axis-meter i {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 4px;
    background: linear-gradient(90deg, var(--green), var(--cyan));
    transform-origin: left;
    transform: scaleX(var(--meter, 0));
}

.button-meter span,
.axis-meter span {
    color: var(--muted);
    font-size: 0.8rem;
}

.button-meter strong,
.axis-meter strong {
    display: block;
    margin-top: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.axes-heading {
    margin-top: 0.8rem;
}

.axis-list {
    display: grid;
    gap: 0.7rem;
}

.axis-meter {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) 58px;
    align-items: center;
    gap: 0.75rem;
    min-height: 52px;
}

.axis-meter div {
    height: 10px;
    border-radius: 999px;
    background: #071006;
    position: relative;
    overflow: hidden;
}

.axis-meter i {
    top: 0;
    bottom: 0;
    height: auto;
    width: 100%;
}

.axis-meter strong {
    margin: 0;
    text-align: right;
}

.diagnostic-panel {
    border-top: 1px solid var(--line);
    padding: 1.25rem;
}

.diagnostic-list,
.note-list {
    display: grid;
    gap: 0.65rem;
    margin: 1rem 0 0;
    padding-left: 1.2rem;
    color: var(--muted);
    line-height: 1.55;
}

.section-block {
    padding: 2rem 0;
}

.controller-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.controller-card,
.legal-grid article,
.model-specs,
.notes-block {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(16, 22, 17, 0.86);
}

.controller-card {
    min-height: 230px;
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
}

.controller-card h3 {
    margin: 0.55rem 0;
}

.controller-card p,
.legal-grid p {
    color: var(--muted);
    line-height: 1.55;
}

.controller-year {
    color: var(--amber);
    font-weight: 800;
}

.card-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: var(--radius);
    background: rgba(66, 214, 111, 0.12);
    border: 1px solid rgba(66, 214, 111, 0.3);
    color: var(--text);
    text-decoration: none;
}

.model-specs {
    display: grid;
    gap: 1px;
    padding: 0;
    overflow: hidden;
}

.model-specs div {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
}

.model-specs dt,
.model-specs dd {
    margin: 0;
}

.legal-page {
    padding: 4rem 0;
}

.legal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.4rem;
}

.legal-grid article {
    padding: 1.25rem;
}

.legal-grid h2 {
    margin: 0 0 0.7rem;
}

.notes-block {
    padding: 1.25rem;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 2rem 0 2.5rem;
    color: var(--muted);
}

.site-footer p {
    margin: 0.35rem 0 0;
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.site-footer a {
    color: var(--muted);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(10px);
}

.donate-modal {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.modal-panel {
    width: min(100%, 460px);
    border: 1px solid rgba(66, 214, 111, 0.24);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.modal-header h2 {
    margin: 0;
}

.icon-button {
    width: 42px;
    aspect-ratio: 1;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
}

.muted {
    color: var(--muted);
    line-height: 1.55;
}

.amount-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
    margin: 1rem 0;
}

.amount-option {
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    font-weight: 800;
}

.amount-option.is-selected {
    border-color: var(--green);
    background: rgba(66, 214, 111, 0.16);
}

.pix-box {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #0b100d;
    padding: 0.9rem;
    margin-bottom: 0.8rem;
}

.pix-box code {
    display: block;
    overflow-wrap: anywhere;
    color: var(--text);
}

.copy-status {
    min-height: 1.4rem;
    margin: 0.65rem 0 0;
    color: var(--green);
}

[hidden] {
    display: none !important;
}

@media (max-width: 980px) {
    .dashboard-hero,
    .model-hero,
    .tester-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        min-height: auto;
    }

    .controller-visual-panel {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .status-grid,
    .controller-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .status-card:nth-child(2) {
        border-right: 0;
    }
}

@media (max-width: 760px) {
    .nav-toggle {
        display: inline-flex;
    }

    .nav-links {
        position: absolute;
        top: 72px;
        left: 1rem;
        right: 1rem;
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: var(--surface);
        box-shadow: var(--shadow);
    }

    .nav-links.is-open {
        display: flex;
    }

    .nav-links a,
    .nav-links button {
        width: 100%;
    }

    .hero-instrument {
        min-height: 320px;
    }

    .tester-toolbar,
    .section-heading,
    .panel-heading,
    .site-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .toolbar-actions,
    .toolbar-actions .button {
        width: 100%;
    }

    .status-grid,
    .controller-card-grid,
    .legal-grid {
        grid-template-columns: 1fr;
    }

    .status-card {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .status-card:last-child {
        border-bottom: 0;
    }

    .button-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .controller-visual {
        min-height: 320px;
    }

    .controller-body {
        width: min(88vw, 420px);
    }
}

@media (max-width: 480px) {
    .nav-shell,
    .site-footer,
    main > section,
    main > div > section {
        width: min(var(--max-width), calc(100% - 1rem));
    }

    .hero-copy h1,
    .model-hero h1,
    .legal-page h1 {
        font-size: 2rem;
    }

    .instrument-list,
    .amount-grid,
    .button-grid {
        grid-template-columns: 1fr;
    }

    .axis-meter {
        grid-template-columns: 46px minmax(0, 1fr) 52px;
        gap: 0.5rem;
        padding: 0.65rem;
    }

    .controller-visual-panel,
    .metrics-panel,
    .diagnostic-panel,
    .tester-toolbar {
        padding: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
