﻿:root {
    --bg: #0d1220;
    --panel: rgba(26, 32, 45, 0.8);
    --panel-soft: rgba(30, 37, 54, 0.84);
    --line: rgba(255, 255, 255, 0.16);
    --text: #eef4ff;
    --muted: #b8c2d8;
    --green: #22c55e;
    --gold: #f5c06a;
    --aqua: #56c7ff;
    --mx: 50%;
    --my: 40%;
    --px: 0px;
    --py: 0px;
    --tilt-x: 0deg;
    --tilt-y: 0deg;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text);
    background: linear-gradient(155deg, #102140 0%, #19263f 36%, #32243a 100%);
}

.savanna-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: linear-gradient(155deg, #102140 0%, #19263f 36%, #32243a 100%);
}

.savanna-bg::before {
    content: '';
    position: absolute;
    inset: -3%;
    background: url('/assets/background.png') center/cover no-repeat;
    opacity: 0.42;
    transform: translate(var(--px), var(--py)) scale(1.05);
    transition: transform 180ms ease-out;
}

.savanna-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 18% 85%, rgba(245, 182, 66, 0.2), transparent 34%),
                radial-gradient(circle at 85% 15%, rgba(41, 182, 246, 0.2), transparent 32%),
                linear-gradient(180deg, rgba(14, 20, 32, 0.3) 0%, rgba(12, 16, 26, 0.6) 100%);
}

.pattern-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 44px 44px;
    transform: translate(calc(var(--px) * -0.25), calc(var(--py) * -0.25));
    transition: transform 200ms ease-out;
}

.container {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 16px;
}

.header {
    margin-top: 14px;
    border: 1px solid rgba(120, 200, 255, 0.32);
    border-radius: 22px;
    background:
        linear-gradient(130deg, rgba(22, 35, 62, 0.7), rgba(36, 25, 55, 0.64)),
        rgba(245, 248, 255, 0.06);
    backdrop-filter: blur(16px) saturate(1.2);
    padding: 10px 12px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    box-shadow:
        0 18px 44px -30px rgba(8, 19, 42, 0.92),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.brand {
    color: #f9fbff;
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    text-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
}

.brand-main {
    font-weight: 800;
    font-size: 25px;
    letter-spacing: 0.03em;
    background: linear-gradient(120deg, #f6fbff, #cde4ff 50%, #ffffff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.brand-accent {
    font-weight: 800;
    font-size: 17px;
    letter-spacing: 0.12em;
    color: var(--gold);
    position: relative;
}

.brand-accent::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    border-radius: 99px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: 0.9;
}

.nav {
    justify-self: center;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border-radius: 999px;
    border: 1px solid rgba(150, 220, 255, 0.28);
    background: rgba(9, 13, 22, 0.56);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.nav a {
    color: #c4d7f6;
    text-decoration: none;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 14px;
    border: 1px solid transparent;
    transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.nav a:hover,
.nav a:first-child {
    color: #ffffff;
    background: linear-gradient(130deg, rgba(85, 162, 255, 0.28), rgba(255, 255, 255, 0.1));
    border-color: rgba(158, 220, 255, 0.34);
    transform: translateY(-1px);
}

.head-actions {
    display: flex;
    gap: 8px;
}

.btn-ghost,
.btn-green {
    position: relative;
    text-decoration: none;
    padding: 9px 15px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    transition: transform 200ms ease, box-shadow 200ms ease, filter 200ms ease;
}

.btn-ghost {
    color: #f5fbff;
    border: 1px solid rgba(133, 211, 255, 0.44);
    background: linear-gradient(130deg, rgba(62, 161, 255, 0.28), rgba(255, 255, 255, 0.12));
    box-shadow: 0 12px 24px -20px rgba(44, 139, 255, 0.7);
}

.btn-green {
    color: #fff;
    background: linear-gradient(135deg, #3de185, #20be66);
    border: 1px solid rgba(39, 204, 108, 0.75);
    box-shadow: 0 12px 24px -20px rgba(22, 176, 92, 0.92);
}

.btn-ghost:hover,
.btn-green:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
}

.btn-ghost:active,
.btn-green:active {
    transform: translateY(0);
}

.hero {
    max-width: 760px;
    margin: 34px auto 0;
    text-align: center;
}

.hero h1 {
    margin: 0;
    font-size: 52px;
    line-height: 1.05;
    text-shadow: 0 10px 34px rgba(4, 8, 18, 0.55);
}

.hero p {
    margin: 14px 0 20px;
    color: #d4ddf0;
    font-size: 19px;
}

.exchange-card {
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: linear-gradient(160deg, rgba(33, 42, 60, 0.78), rgba(26, 31, 47, 0.82));
    border-radius: 24px;
    padding: 14px;
    text-align: left;
    box-shadow: 0 22px 48px -36px rgba(4, 10, 24, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.28);
    overflow: hidden;
    backdrop-filter: blur(12px);
    transform: perspective(1200px) rotateX(var(--tilt-y)) rotateY(var(--tilt-x));
    transition: transform 220ms ease, box-shadow 220ms ease;
}

.exchange-card::before,
.exchange-card::after {
    content: '';
    position: absolute;
    pointer-events: none;
    z-index: 0;
    opacity: 0.62;
}

.exchange-card::before {
    width: 170px;
    height: 170px;
    right: -70px;
    top: -80px;
    border-radius: 48% 52% 57% 43%;
    background: radial-gradient(circle at var(--mx) var(--my), rgba(86, 199, 255, 0.5), rgba(86, 199, 255, 0));
}

.exchange-card::after {
    width: 180px;
    height: 160px;
    left: -70px;
    bottom: -90px;
    border-radius: 54% 46% 43% 57%;
    background: radial-gradient(circle at 60% 40%, rgba(245, 192, 106, 0.26), rgba(245, 192, 106, 0));
}

.tabs {
    --blob-shift: 0%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
    position: relative;
    padding: 5px;
    border-radius: 14px;
    overflow: hidden;
    isolation: isolate;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.16);
    z-index: 1;
}

.tab-blob {
    position: absolute;
    left: 4px;
    top: 4px;
    bottom: 4px;
    width: calc(50% - 6px);
    border-radius: 10px;
    background:
        radial-gradient(120% 120% at 20% 20%, rgba(255, 255, 255, 0.5), transparent 55%),
        linear-gradient(125deg, rgba(44, 208, 113, 0.95), rgba(33, 173, 92, 0.95));
    box-shadow:
        0 10px 20px -14px rgba(21, 158, 84, 0.9),
        inset 0 1px 0 rgba(255, 255, 255, 0.45);
    transform: translateX(var(--blob-shift));
    transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
                background 280ms ease,
                box-shadow 280ms ease;
    z-index: 0;
}

.tabs.sell .tab-blob {
    background:
        radial-gradient(120% 120% at 20% 20%, rgba(255, 255, 255, 0.45), transparent 55%),
        linear-gradient(125deg, rgba(78, 179, 255, 0.96), rgba(39, 122, 247, 0.94));
    box-shadow:
        0 10px 20px -14px rgba(48, 121, 255, 0.95),
        inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.tabs.splash .tab-blob::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    opacity: 0;
    animation: blobSplash 520ms ease-out;
}

.tab {
    min-height: 42px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: transparent;
    color: #d0d8eb;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 180ms ease, background-color 180ms ease;
    position: relative;
    z-index: 1;
}

.tab:hover {
    transform: translateY(-1px) scale(1.01);
}

.tab.active {
    color: #fff;
    background: transparent;
}

.field {
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.field label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.field input {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    background: rgba(12, 16, 26, 0.38);
    color: #fff;
    padding: 12px;
    font: inherit;
    font-size: 22px;
    font-weight: 700;
    outline: none;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.field input:focus {
    border-color: rgba(110, 205, 255, 0.74);
    box-shadow: 0 0 0 3px rgba(86, 199, 255, 0.14);
    transform: translateY(-1px);
}

.currency-pill {
    min-width: 86px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.08);
    font-weight: 700;
}

.asset-wrap {
    position: relative;
}

.asset-select {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font: inherit;
    font-weight: 700;
    padding: 10px 38px 10px 14px;
}

.expand {
    position: absolute;
    right: 10px;
    top: 9px;
    pointer-events: none;
    color: #d0d8eb;
}

.swap-hint {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #c7d1e7;
    font: inherit;
    padding: 8px 10px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.swap-hint:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px -22px rgba(95, 173, 255, 0.9);
    filter: saturate(1.08);
}

.vip-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 12px;
    position: relative;
    z-index: 1;
}

.vip-tag {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--line);
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 700;
}

.vip-value {
    color: #b7f4cd;
    font-size: 14px;
    font-weight: 700;
}

.promo-box {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    padding: 12px;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.promo-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
    color: #e3e9f6;
    margin: 6px 0;
}

.promo-row.total {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    color: #fff;
    font-weight: 700;
}

.anim-value {
    font-variant-numeric: tabular-nums;
    transition: text-shadow 180ms ease;
}

.anim-value.bump {
    text-shadow: 0 0 14px rgba(255, 255, 255, 0.35);
}

.submit-btn,
.operator-btn {
    width: 100%;
    min-height: 46px;
    border-radius: 12px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.submit-btn {
    border: none;
    background: linear-gradient(120deg, #29c76c, #17a958);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 14px 26px -20px rgba(24, 185, 96, 0.92);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 30px -20px rgba(24, 185, 96, 0.95);
}

.operator-btn {
    margin-top: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.operator-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px -20px rgba(69, 175, 255, 0.9);
}

.result {
    display: none;
    margin-top: 8px;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
}

.result.ok {
    display: block;
    border: 1px solid rgba(34, 197, 94, 0.6);
    background: rgba(34, 197, 94, 0.15);
}

.result.err {
    display: block;
    border: 1px solid rgba(239, 68, 68, 0.6);
    background: rgba(239, 68, 68, 0.14);
}

@keyframes sweep {
    0% { transform: translateX(-120%); }
    55% { transform: translateX(120%); }
    100% { transform: translateX(120%); }
}

@keyframes blobSplash {
    0% {
        opacity: 0.55;
        transform: scale(0.78);
    }
    100% {
        opacity: 0;
        transform: scale(1.08);
    }
}

@media (max-width: 980px) {
    .nav { display: none; }
    .brand { font-size: 20px; }
    .hero h1 { font-size: 38px; }
    .hero p { font-size: 16px; }
}

@media (max-width: 680px) {
    .container { padding: 0 10px; }
    .header { border-radius: 14px; padding: 8px; }
    .head-actions a { padding: 8px 10px; font-size: 12px; }
    .hero { margin-top: 20px; }
    .hero h1 { font-size: 30px; }
    .exchange-card { border-radius: 26px; padding: 12px; }
    .field input { font-size: 18px; border-radius: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .savanna-bg::before,
    .pattern-overlay,
    .exchange-card {
        transform: none !important;
        transition: none !important;
    }
}
