:root {
    color-scheme: dark;
    --bg: #050806;
    --surface: #0c130e;
    --surface-raised: #121c15;
    --line: #243329;
    --line-bright: #3e5d47;
    --text: #f3f7f4;
    --muted: #96a89b;
    --accent: #56f58b;
    --accent-strong: #2cd96b;
    --accent-ink: #031108;
    --warning: #ffcb66;
    --warning-bg: #211907;
    --danger: #ff7b82;
    --danger-bg: #240b0e;
    --radius-lg: 22px;
    --radius-md: 14px;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 0%, rgba(86, 245, 139, 0.13), transparent 32rem),
        radial-gradient(circle at 90% 25%, rgba(44, 217, 107, 0.08), transparent 28rem),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

a {
    color: var(--accent);
}

.site-header,
.page-shell,
footer {
    width: min(1160px, calc(100% - 40px));
    margin-inline: auto;
}

.site-header {
    min-height: 86px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid rgba(150, 168, 155, 0.16);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

#logo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 50%;
    box-shadow: 0 0 26px rgba(86, 245, 139, 0.24);
}

.brand span {
    display: grid;
}

.brand strong {
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.brand small,
.stat-card small,
.contract-link-card span {
    color: var(--muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.network-pill,
.direction-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(12, 19, 14, 0.82);
    font-size: 0.8rem;
    font-weight: 700;
}

.network-pill.ready {
    color: var(--accent);
    border-color: rgba(86, 245, 139, 0.34);
}

.page-shell {
    padding: 72px 0 40px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 40px;
    margin-bottom: 38px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 760px;
    margin-bottom: 16px;
    font-size: clamp(2.35rem, 6vw, 5rem);
    line-height: 0.98;
    letter-spacing: -0.055em;
}

h2 {
    margin-bottom: 0;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.hero-copy {
    max-width: 680px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1.05rem;
}

.contract-link-card {
    min-width: 190px;
    padding: 16px 18px;
    display: grid;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(12, 19, 14, 0.7);
}

.contract-link-card a {
    font-weight: 800;
    text-decoration: none;
}

.alert {
    margin-bottom: 22px;
    padding: 16px 18px;
    border: 1px solid;
    border-radius: var(--radius-md);
    font-weight: 650;
}

.alert-warning {
    color: var(--warning);
    border-color: rgba(255, 203, 102, 0.4);
    background: var(--warning-bg);
}

.alert-error {
    color: var(--danger);
    border-color: rgba(255, 123, 130, 0.4);
    background: var(--danger-bg);
}

.hidden {
    display: none !important;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: rgba(12, 19, 14, 0.76);
    box-shadow: var(--shadow);
}

.stat-card {
    min-height: 126px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    border-right: 1px solid var(--line);
}

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

.stat-card > span,
.transaction-panel > span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.stat-card strong {
    font-size: 1.18rem;
}

.trade-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    margin-top: 22px;
}

.trade-card,
.wallet-panel,
.transaction-panel,
.info-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: linear-gradient(150deg, rgba(18, 28, 21, 0.96), rgba(9, 15, 11, 0.96));
}

.trade-card {
    padding: clamp(22px, 4vw, 34px);
}

.card-heading,
.wallet-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.card-heading {
    margin-bottom: 28px;
}

.trade-card label {
    display: block;
    margin-bottom: 9px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.route-status {
    min-height: 48px;
    margin: -12px 0 20px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--muted);
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.8rem;
}

.route-status.ready {
    color: var(--accent);
    border-color: rgba(86, 245, 139, 0.3);
}

.route-status.pending {
    color: var(--warning);
    border-color: rgba(255, 203, 102, 0.3);
}

.trade-note {
    display: block;
    margin-top: 14px;
    color: var(--muted);
    line-height: 1.5;
}

.asset-input {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    border: 1px solid var(--line-bright);
    border-radius: var(--radius-md);
    background: #070c08;
    overflow: hidden;
}

.asset-input:focus-within {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px rgba(86, 245, 139, 0.1);
}

.asset-input input {
    min-width: 0;
    padding: 17px 18px;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
    font-size: 1.4rem;
    font-weight: 750;
}

.asset-input span {
    padding: 0 18px;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 850;
}

.quote-row {
    min-height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
}

.quote-row strong {
    color: var(--text);
    text-align: right;
}

.button {
    min-height: 46px;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 800;
    transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(86, 245, 139, 0.42);
    outline-offset: 3px;
}

.button-primary {
    color: var(--accent-ink);
    background: var(--accent);
}

.button-primary:hover:not(:disabled) {
    background: #7affaa;
}

.button-secondary {
    color: var(--text);
    border-color: var(--line-bright);
    background: var(--surface-raised);
}

.button:disabled {
    color: #667269;
    border-color: #253029;
    background: #151b17;
    cursor: not-allowed;
}

.full-width {
    width: 100%;
}

.wallet-panel {
    margin-top: 22px;
    padding: 24px 28px;
}

.wallet-panel p:last-child,
.info-card p,
#walletAddress {
    margin: 6px 0 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.transaction-panel {
    margin-top: 22px;
    padding: 20px 24px;
}

#txStatus {
    margin-top: 7px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

#txStatus a {
    font-weight: 800;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    margin-top: 22px;
}

.info-card {
    padding: 28px;
}

.info-card h2 {
    margin-bottom: 18px;
}

.wallet-import-steps {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
}

.contract-address {
    display: block;
    margin-top: 7px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.78rem;
    overflow-wrap: anywhere;
    user-select: all;
}

.info-card dl {
    margin: 0;
}

.info-card dl div {
    padding: 12px 0;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
}

.info-card dl div:last-child {
    border-bottom: 0;
}

.info-card dt {
    color: var(--muted);
}

.info-card dd {
    margin: 0;
    text-align: right;
    font-weight: 750;
}

footer {
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    color: var(--muted);
    border-top: 1px solid rgba(150, 168, 155, 0.16);
    font-size: 0.86rem;
}

footer a {
    text-decoration: none;
}

@media (max-width: 880px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .stat-card:nth-child(-n + 2) {
        border-bottom: 1px solid var(--line);
    }

    .hero {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .contract-link-card {
        width: fit-content;
    }
}

@media (max-width: 720px) {
    .site-header,
    .page-shell,
    footer {
        width: min(100% - 28px, 1160px);
    }

    .site-header {
        padding: 14px 0;
        align-items: flex-start;
    }

    .header-actions {
        flex-direction: column-reverse;
        align-items: flex-end;
        gap: 7px;
    }

    .page-shell {
        padding-top: 48px;
    }

    .trade-grid,
    .details-grid {
        grid-template-columns: 1fr;
    }

    .wallet-panel,
    footer {
        align-items: flex-start;
        flex-direction: column;
    }

    footer {
        justify-content: center;
    }
}

@media (max-width: 500px) {
    .brand small,
    .network-pill {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card,
    .stat-card:nth-child(2) {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

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

    .wallet-panel {
        padding: 22px;
    }

    .wallet-panel .button {
        width: 100%;
    }
}

.testnet-pill {
    color: var(--warning);
    border-color: rgba(255, 203, 102, 0.34);
}

.network-pill.status-bad {
    color: var(--danger);
    border-color: rgba(255, 123, 130, 0.38);
}

.testnet-shell {
    padding-bottom: 64px;
}

.testnet-hero h1 {
    max-width: 820px;
}

.contract-link-card strong {
    color: var(--warning);
}

.testnet-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.deployment-card {
    min-height: 100%;
}

.deployment-copy {
    color: var(--muted);
}

.deployment-facts {
    margin: 0 0 22px;
}

.deployment-facts div {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

.deployment-facts dt {
    color: var(--muted);
}

.deployment-facts dd {
    margin: 0;
    text-align: right;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.deployment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.deployment-actions .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.trade-card .confirmation-check {
    margin: 22px 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--text);
    cursor: pointer;
}

.confirmation-check input {
    width: 19px;
    height: 19px;
    margin: 2px 0 0;
    accent-color: var(--accent);
    flex: 0 0 auto;
}

.deployment-card > .button {
    width: 100%;
}

.deployment-results {
    align-items: center;
}

.deployment-results .button {
    flex: 0 0 auto;
}

.deployment-details dd,
.deployment-details dd a {
    overflow-wrap: anywhere;
}

.deployment-log {
    margin: 0;
    padding-left: 22px;
    color: var(--muted);
}

.deployment-log li {
    padding: 5px 0;
}

.deployment-log a {
    white-space: nowrap;
}

.verification-card {
    margin-top: 22px;
}

.verification-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.verification-grid > * {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.verification-grid > :nth-last-child(-n + 2) {
    border-bottom: 0;
}

.verification-grid span {
    color: var(--muted);
}

.verification-grid strong {
    text-align: right;
}

.check-pass {
    color: var(--accent);
}

.mainnet-pill {
    color: var(--danger);
    border-color: rgba(255, 123, 130, 0.45);
}

.mainnet-contract-card a {
    color: var(--danger);
    font-weight: 800;
    text-decoration: none;
}

.mainnet-preflight-card {
    margin-bottom: 22px;
}

.mainnet-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 30px;
}

.mainnet-facts div {
    min-width: 0;
}

.mainnet-stage-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.mainnet-stage-card {
    min-height: 100%;
}

.stage-results {
    margin: 22px 0 0;
}

.stage-results div {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.stage-results div:last-child {
    border-bottom: 0;
}

.stage-results dt {
    color: var(--muted);
}

.stage-results dd {
    margin: 0;
    text-align: right;
    overflow-wrap: anywhere;
}

.stage-status {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.deployment-recovery {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.deployment-recovery .button {
    width: 100%;
}

.upgrade-gate-card {
    margin-top: 22px;
    border-color: rgba(255, 123, 130, 0.35);
}

.danger-badge {
    color: var(--danger);
    border-color: rgba(255, 123, 130, 0.38);
}

.typed-confirmation {
    display: grid;
    gap: 10px;
    margin: 0 0 20px;
    color: var(--muted);
}

.typed-confirmation input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px 14px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    font: inherit;
}

.typed-confirmation input:focus {
    outline: 2px solid rgba(255, 123, 130, 0.35);
    border-color: var(--danger);
}

.button-danger {
    width: 100%;
    color: #180608;
    background: var(--danger);
    border-color: var(--danger);
}

.button-danger:hover:not(:disabled) {
    filter: brightness(1.08);
}

code {
    color: var(--warning);
}

@media (max-width: 760px) {
    .testnet-layout {
        grid-template-columns: 1fr;
    }

    .mainnet-stage-grid,
    .mainnet-facts {
        grid-template-columns: 1fr;
    }

    .deployment-actions {
        flex-direction: column;
    }

    .deployment-results {
        align-items: flex-start;
    }
}

@media (max-width: 520px) {
    .verification-grid {
        grid-template-columns: 1fr;
    }

    .verification-grid > * {
        border-bottom: 0;
    }

    .verification-grid strong {
        padding-top: 0;
        text-align: left;
        border-bottom: 1px solid var(--line);
    }

    .verification-grid > :last-child {
        border-bottom: 0;
    }
}
