:root {
    --neon-cyan: #22d3ee;
    --neon-purple: #a855f7;
    --neon-pink: #ec4899;
}

/* ===== Card Wrapper ===== */
#swap {
    display: none;
    margin: 50px
}


.neon-card {
    width: 420px;
    padding: 6px 22px 22px 22px;
    border-radius: 20px;
    position: relative;
    background: rgba(12, 12, 18, 0.75);
    backdrop-filter: blur(14px);
    color: #e5e7eb;
    font-family: var(--font-sans);

    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.65),
        0 0 40px rgba(168, 85, 247, 0.15);
}

/* Neon border */
.neon-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 22px;
    padding: 1px;
    background: linear-gradient(135deg,
            var(--neon-cyan),
            var(--neon-purple),
            var(--neon-pink));
    mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    mask-composite: exclude;
    pointer-events: none;
}

/* ===== Header ===== */
.card-header {
    margin-bottom: 18px;
}

.card-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    text-shadow:
        0 0 8px rgba(168, 85, 247, 0.6);
    margin-bottom: 18px;
}

.card-settings {
    opacity: 0.7;
    font-size: 1.2rem;
}

/* ===== Arena entrance title ===== */
.arena-card .card-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
}

.arena-card .card-title {
    align-self: stretch;
    order: -1;
    text-align: center;
    font-size: 2.2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin: 0;
    background: linear-gradient(90deg,
            var(--neon-cyan),
            var(--neon-purple),
            var(--neon-pink),
            var(--neon-cyan));
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none;
    animation:
        arena-title-flow 4s linear infinite,
        arena-title-pulse 1.6s ease-in-out infinite,
        arena-title-enter 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

@keyframes arena-title-flow {
    to {
        background-position: 300% 0;
    }
}

@keyframes arena-title-pulse {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.55));
    }

    50% {
        transform: scale(1.045);
        filter: drop-shadow(0 0 28px rgba(236, 73, 153, 0.9));
    }
}

@keyframes arena-title-enter {
    0% {
        opacity: 0;
        transform: scale(0.6) translateY(-16px);
        letter-spacing: 0.5em;
    }

    60% {
        opacity: 1;
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        letter-spacing: 0.14em;
    }
}

@media (prefers-reduced-motion: reduce) {
    .arena-card .card-title {
        animation: none;
    }
}

/* ===== Swap Sections ===== */
.swap-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 14px;
}

.swap-label {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 6px;
}

.swap-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.token {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.token-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, #22d3ee, #0ea5e9);
}

.amount-input {
    padding: 10px 14px;
    font-size: 16px;
    font-weight: 500;
    color: #00ffc3;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 255, 200, 0.3);
    border-radius: 14px;
    outline: none;
    text-align: right;
    transition: all 0.25s ease;
}

/* No native spinner: it rendered as a white block on the dark field, and
   arrows that step by 1 make no sense for token amounts. */
.amount-input,
.stake-input {
    appearance: textfield;
    -moz-appearance: textfield;
}

.amount-input::-webkit-inner-spin-button,
.amount-input::-webkit-outer-spin-button,
.stake-input::-webkit-inner-spin-button,
.stake-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.deposit-unit:empty {
    display: none;
}

.amount-input::placeholder {
    color: rgba(0, 255, 200, 0.5);
}

.amount-input:focus {
    background: rgba(0, 0, 0, 0.35);
    border-color: #00ffc3;
    box-shadow: 0 0 10px rgba(0, 255, 200, 0.4);
}

/* Arrow divider */
.swap-arrow {
    display: flex;
    justify-content: center;
    margin: 6px 0 10px;
    color: #a855f7;
    font-size: 1.2rem;
}

/* ===== Action Button ===== */
.swap-button {
    width: 100%;
    height: 50px;
    margin-top: 12px;
    border-radius: 16px;
    border: none;
    cursor: pointer;

    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;

    background: linear-gradient(135deg,
            var(--neon-cyan),
            var(--neon-purple));

    box-shadow:
        0 0 25px rgba(168, 85, 247, 0.65),
        inset 0 0 0 rgba(255, 255, 255, 0);

    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.swap-button:hover {
    transform: translateY(-1px);
    box-shadow:
        0 0 35px rgba(168, 85, 247, 0.85);
}

/* ===== Leverage Position ===== */
.leverage-box {
    margin-top: 10px;
    padding: 10px 14px;
    background: rgba(168, 85, 247, 0.06);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 10px;
}

.leverage-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #c4b5fd;
    margin-bottom: 10px;
    font-weight: 600;
}

.leverage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.leverage-row:last-of-type {
    margin-bottom: 0;
}

.leverage-sub-label {
    color: #9ca3af;
    flex-shrink: 0;
}

/* Track + Collateral share a row: two label/pill pairs. */
.leverage-pair {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Settings + How to Play side by side; the settings panel spans both. */
.arena-card .menu-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 10px 0 0;
}

.arena-card .menu-actions .glass-button {
    width: 100%;
    padding: 9px 8px;
}

.arena-card .menu-actions .settings-box {
    grid-column: 1 / -1;
    margin-top: 0;
    padding: 10px 14px;
}

/* Settings: toggles in two columns, small type, so opening the panel adds
   ~3 short rows to the card instead of a tall list. */
.arena-card .menu-actions .settings-box ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
}

.arena-card .menu-actions .settings-box li {
    margin: 0;
    font-size: 0.85rem;
}

.arena-card .menu-actions .settings-box label {
    gap: 8px;
}

.arena-card .menu-actions .settings-box input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.arena-card .menu-actions .settings-box input[type="checkbox"]::before {
    font-size: 11px;
    top: -1px;
    left: 2px;
}

.arena-card .menu-actions .settings-box .lev-slider-row {
    margin: 10px 0 0;
    font-size: 0.85rem;
}

.leverage-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.leverage-pill {
    appearance: none;
    background: rgba(18, 18, 18, 0.65);
    color: #d1d5db;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.96rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.leverage-pill:hover {
    background: rgba(168, 85, 247, 0.18);
    color: #fff;
}

.leverage-pill.active {
    background: rgba(168, 85, 247, 0.35);
    border-color: rgba(168, 85, 247, 0.7);
    color: #fff;
}

.leverage-pill.leverage-long.active {
    background: rgba(34, 197, 94, 0.32);
    border-color: rgba(34, 197, 94, 0.7);
}

.leverage-pill.leverage-short.active {
    background: rgba(239, 68, 68, 0.32);
    border-color: rgba(239, 68, 68, 0.7);
}

.leverage-preview {
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #c4b5fd;
    text-align: right;
}

/* ===== Footer Info ===== */
.card-footer {
    margin-top: 14px;
    font-size: 0.8rem;
    color: #9ca3af;
    display: grid;
    gap: 4px;
}

#route {
    color: #bbb;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    word-break: break-word;
}

#priceImpact {
    color: #9ca3af;
}

#priceImpact.warn {
    color: #fbbf24;
    font-weight: 600;
}

#priceImpact.high {
    color: #f87171;
    font-weight: 700;
}

.token-dropdown {
    position: relative;
    width: 140px;
    font-family: var(--font-sans);
    color: #00ffc3;
    cursor: pointer;
}

/* Selected */
.token-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    background: rgba(18, 18, 18, 0.65);
    backdrop-filter: blur(12px) saturate(160%);
    border: 1px solid rgba(0, 255, 200, 0.35);
    border-radius: 14px;
    transition: all 0.25s ease;
}

.token-selected:hover {
    background: rgba(18, 18, 18, 0.85);
    box-shadow: 0 0 12px rgba(0, 255, 200, 0.15);
}

.token-dropdown.open .token-selected {
    box-shadow: 0 0 18px rgba(0, 255, 200, 0.25);
}

/* Arrow */
.arrow {
    font-size: 11px;
    transition: transform 0.25s ease;
}

.token-dropdown.open .arrow {
    transform: rotate(180deg);
}

/* Dropdown panel */
.token-panel {
    position: absolute;
    top: 110%;
    left: 0;
    width: 100%;
    background: rgba(15, 17, 22, 0.95);
    backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid rgba(0, 255, 200, 0.3);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 255, 200, 0.18);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.token-dropdown.open .token-panel {
    display: block;
}

/* Search */
.token-search {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    border: none;
    outline: none;
    background: rgba(10, 12, 18, 0.9);
    color: #fff;
    border-bottom: 1px solid rgba(0, 255, 200, 0.15);
}

.token-search::placeholder {
    color: #777;
}

/* Token list */
.token-options {
    max-height: 260px;
    overflow-y: auto;
}

/* Token row */
.token-option {
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    transition: background 0.2s ease, padding-left 0.2s ease;
}

.token-option:hover {
    background: rgba(0, 255, 200, 0.12);
    padding-left: 16px;
}

/* Icon */
.token-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00ffc3, #00bfa6);
    flex-shrink: 0;
}

/* Scrollbar */
.token-options::-webkit-scrollbar {
    width: 6px;
}

.token-options::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 200, 0.35);
    border-radius: 4px;
}

.by-aero {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;

    color: #7dd3fc;
    opacity: 0.85;

    padding: 2px 6px;
    border-radius: 6px;

    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.25);

    box-shadow:
        inset 0 0 6px rgba(34, 211, 238, 0.2);
}

.by-aero a {
    color: inherit;
    text-decoration: none;
    font-weight: inherit;
    font-size: inherit;
}

.by-aero a:hover {
    opacity: 0.8;
}

.card-subtitle {
    font-weight: 500;
    letter-spacing: 0.3px;
    margin: 10px 0;
    color: rgba(255, 255, 255, 0.55);
    font-size: 1.3rem;

}

.swap-button.loading {
    pointer-events: none;
    opacity: 0.8;
}

.swap-button.loading::after {
    content: "…";
    animation: dots 1.4s infinite;
}

@keyframes dots {
    0% {
        content: "";
    }

    33% {
        content: ".";
    }

    66% {
        content: "..";
    }

    100% {
        content: "...";
    }
}

.swap-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.75);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    border-radius: 16px;
    z-index: 50;
}

.swap-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.swap-overlay-content {
    text-align: center;
    color: white;
    animation: fadeUp 0.4s ease;
}

.overlay-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.overlay-sub {
    font-size: 0.95rem;
    opacity: 0.8;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================== E2: leverage-first entry card ===================== */

/* Balance header */
.deposit-btn {
    appearance: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #d6f9ef;
    padding: 5px 9px;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 200, 0.4);
    background: rgba(0, 255, 200, 0.1);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.deposit-btn:hover {
    background: rgba(0, 255, 200, 0.22);
    box-shadow: 0 0 14px rgba(0, 255, 200, 0.35);
}

/* Balance on the left, wallet actions on the right, one strip. */
.arena-header-row {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px 8px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.arena-header-row .card-header-actions {
    flex-wrap: nowrap;
    flex-shrink: 0;
    align-self: stretch;
    gap: 5px;
}

/* Icon over label: tall tiles fill the strip's height without taking the
   width the balance needs. */
.arena-header-row .deposit-btn {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-width: 60px;
    padding: 6px 7px;
    font-size: 0.82rem;
    line-height: 1.1;
}

.arena-header-row .btn-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.arena-balance-row {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    line-height: 1.15;
}

.arena-balance-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #9ca3af;
}

.arena-balance {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
    color: #00ffc3;
    text-shadow: 0 0 10px rgba(0, 255, 200, 0.4);
}

/* The balance token by token, under its USD value. */
.in-play-banner {
    margin: 6px 0;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    color: #fde68a;
    background: rgba(234, 179, 8, 0.12);
    border: 1px solid rgba(234, 179, 8, 0.4);
}

.arena-balance-tokens {
    margin-top: 2px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Stake value and the balance of the staked token, under the stake input. */
.stake-hint {
    margin: -4px 0 8px;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: #9ca3af;
}

/* Stake input */
.stake-input-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(0, 255, 200, 0.3);
}

.stake-unit {
    color: rgba(0, 255, 200, 0.7);
    font-weight: 700;
}

.stake-input {
    width: 90px;
    background: transparent;
    border: none;
    outline: none;
    text-align: right;
    color: #00ffc3;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

/* Leverage slider */
.lev-slider-row {
    margin-top: 6px;
    margin-bottom: 8px;
}

.lev-slider-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 2px 10px;
    margin-bottom: 6px;
}

/* Never split the readout over two lines: on a narrow card it moves, whole,
   to its own line under the label instead of touching it. */
.lev-readout {
    margin-left: auto;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-weight: 700;
    color: #c4b5fd;
}

.lev-readout.muted {
    color: #f59e0b;
}

.lev-slider {
    width: 100%;
    accent-color: var(--neon-purple);
    cursor: pointer;
}

/* Exposure / entry / liq line */
.exposure-line {
    margin-top: 8px;
    font-family: var(--font-mono);
    color: #c4b5fd;
    text-align: right;
    font-size: small;
}

/* Pre-entry crowd bar */
.entry-crowd {
    margin-top: 12px;
}

.entry-crowd-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    margin-bottom: 4px;
}

.entry-crowd-asset {
    color: #9ca3af;
    letter-spacing: 0.08em;
}

.entry-crowd .up {
    color: #22c55e;
}

.entry-crowd .down {
    color: #ef4444;
}

.entry-crowd-bar {
    display: flex;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.5);
}

.entry-crowd-long {
    background: linear-gradient(90deg, #16a34a, #22c55e);
}

.entry-crowd-short {
    background: linear-gradient(90deg, #ef4444, #b91c1c);
}

/* Inline entry error */
.enter-error {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.82rem;
    color: #fecaca;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

#depositError {
    margin: 0 0 10px;
}

.swap-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.4);
}

/* ===================== Deposit modal ===================== */
.deposit-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 6, 12, 0.72);
    backdrop-filter: blur(6px);
}

.deposit-modal[hidden] {
    display: none;
}

.deposit-content {
    width: 360px;
    font-family: var(--font-sans);
}

.deposit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.deposit-sub {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 14px;
}

.deposit-faucet {
    font-size: 0.8rem;
    color: #7dd3fc;
    margin: -6px 0 14px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.25);
}

.deposit-faucet a {
    color: #22d3ee;
    font-weight: 600;
}

.deposit-faucet[hidden] {
    display: none;
}

.deposit-token-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.deposit-token-list:not(:empty) {
    margin-bottom: 8px;
}

/* The hidden attribute always wins inside the money modals: several of
   their parts are shown or hidden per network rail. */
.deposit-content [hidden] {
    display: none !important;
}

.deposit-token {
    appearance: none;
    cursor: pointer;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #d1d5db;
    background: rgba(18, 18, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.deposit-token:hover {
    background: rgba(0, 255, 200, 0.15);
}

/* Wallet balance under each quick-token symbol; hidden until known. */
.deposit-token-bal {
    display: block;
    font-size: 0.62rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
}

.deposit-token-bal:empty {
    display: none;
}

.deposit-token.active .deposit-token-bal {
    color: rgba(255, 255, 255, 0.7);
}

.deposit-token.active {
    background: rgba(0, 255, 200, 0.25);
    border-color: rgba(0, 255, 200, 0.6);
    color: #fff;
}

.deposit-dest-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.deposit-dest {
    font-size: 1.1rem;
    font-weight: 700;
    color: #00ffc3;
    font-family: var(--font-mono);
}

/* Live quote line under the rate (min received, price impact). */
.deposit-detail {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 2px;
}

.deposit-detail.warn {
    color: #fbbf24;
}

/* ===== Withdraw modal (G4) ===== */
.withdraw-list {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.withdraw-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.78rem;
}

.withdraw-row-label {
    color: rgba(255, 255, 255, 0.75);
}

.withdraw-row-amount {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    color: #e5e7eb;
}

.withdraw-row-state {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.72rem;
    white-space: nowrap;
}

.withdraw-claim-btn {
    flex: 0 0 auto;
}

.withdraw-max {
    flex: 0 0 auto;
}

.withdraw-empty {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    text-align: center;
    padding: 8px 0;
}

.close-btn {
    appearance: none;
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: #fff;
}

/* ===================== Respawn overlay ===================== */
.respawn-overlay {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 6, 12, 0.82);
    backdrop-filter: blur(8px);
}

.respawn-overlay[hidden] {
    display: none;
}

.respawn-content {
    width: 340px;
    text-align: center;
    font-family: var(--font-sans);
    animation: fadeUp 0.35s ease;
}

.respawn-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #f87171;
    text-shadow: 0 0 16px rgba(239, 68, 68, 0.6);
    margin-bottom: 6px;
}

.respawn-sub {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 16px;
}

.respawn-content .stake-row {
    justify-content: center;
    margin-bottom: 14px;
}

.respawn-menu-btn {
    appearance: none;
    margin-top: 10px;
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
}

.respawn-menu-btn:hover {
    color: #fff;
}
/* In-card GO RUG: phones only (the floating one covers Settings there). */
.rug-inline {
    display: none;
}

/* ===================== Mobile (<= 640px) =====================
   Desktop keeps the fixed 420px card. On phones the card goes fluid, the
   menu scrolls under the header bar (body is overflow:hidden), controls get
   finger-sized, and every modal scrolls inside the viewport. */
@media (max-width: 640px) {
    #startMenuWrapper {
        height: 100%;
        box-sizing: border-box;
        align-items: flex-start;
        padding: 68px 12px 24px;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    /* The floating GO RUG covered the bottom left of Settings: hide it
       (the JS sets an inline display, hence !important) and show the copy
       inside the card instead. */
    .play-button-container {
        display: none !important;
    }

    .rug-inline {
        display: flex;
        justify-content: center;
        margin-top: 14px;
    }

    .play-rug {
        padding: 10px 18px;
        font-size: 0.85rem;
    }

    #swap {
        width: 100%;
        max-width: 420px;
        margin: 0;
    }

    .neon-card {
        width: 100%;
        box-sizing: border-box;
        padding: 6px 16px 18px;
    }

    .arena-card .card-title {
        font-size: 2rem;
        letter-spacing: 0.1em;
    }

    /* Narrow: balance on top, the three actions as a row under it. */
    .arena-header-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .arena-balance-row {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: baseline;
        justify-content: space-between;
        column-gap: 8px;
    }

    .arena-card .card-header-actions {
        display: grid;
        /* As many equal columns as there are visible actions. */
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        width: 100%;
        gap: 6px;
    }

    .arena-card .card-header-actions .deposit-btn {
        justify-content: center;
        min-height: 48px;
        min-width: 0;
        padding: 4px 6px;
        font-size: 0.85rem;
    }

    .arena-balance {
        font-size: 1.2rem;
    }

    .leverage-box {
        padding: 12px;
    }

    .leverage-row {
        margin-bottom: 10px;
    }

    /* Track and Collateral each get a full-width line: side by side, the
       five collateral pills stacked into one column ~400px tall. */
    .leverage-row-pair {
        flex-direction: column;
        align-items: stretch;
    }

    .leverage-row-pair .leverage-pair {
        justify-content: space-between;
    }

    .leverage-group[data-group="collateral"] {
        justify-content: flex-end;
    }

    .leverage-group[data-group="collateral"] .leverage-pill {
        padding: 6px 11px;
    }

    .leverage-pill {
        min-height: 36px;
        padding: 6px 14px;
    }

    .stake-input-wrap {
        min-height: 40px;
        box-sizing: border-box;
    }

    /* 16px keeps iOS Safari from zooming into the field on focus. */
    .stake-input,
    .amount-input {
        font-size: 16px;
    }

    .lev-slider {
        height: 28px;
    }

    .exposure-line {
        font-size: 0.72rem;
        line-height: 1.5;
    }

    .swap-button {
        height: 52px;
    }

    /* Modals: the overlay scrolls, the card centres with margin:auto so a
       tall card starts at the top instead of being clipped above it. */
    .deposit-modal,
    .respawn-overlay {
        overflow-y: auto;
        padding: 12px;
        box-sizing: border-box;
    }

    .deposit-content,
    .deposit-content.info-panel,
    .respawn-content {
        width: 100%;
        max-width: 420px;
        margin: auto;
        box-sizing: border-box;
    }

    .deposit-token {
        min-height: 36px;
    }

    .amount-input {
        min-width: 0;
        flex: 1;
    }

    .swap-row {
        gap: 8px;
    }
}
