/* === reset & base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --primary: #22c55e;
    --primary-dark: #16a34a;
    --primary-light: #dcfce7;
    --bg: #0f172a;
    --bg2: #1e293b;
    --bg3: #334155;
    --border: rgba(255,255,255,0.08);
    --border2: rgba(255,255,255,0.15);
    --text: #f1f5f9;
    --text2: #94a3b8;
    --text3: #64748b;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
}
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }

/* === layout === */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 768px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* === nav === */
nav { background: var(--bg2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.nav-inner { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; }
.logo { font-size: 1.25rem; font-weight: 700; color: var(--primary); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo svg { width: 28px; height: 28px; }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a { color: var(--text2); text-decoration: none; font-size: 0.9rem; transition: color .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }

/* === hero === */
.hero { padding: 5rem 0 3rem; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.15; margin-bottom: 1rem; }
.hero h1 span { color: var(--primary); }
.hero p { font-size: 1.1rem; color: var(--text2); max-width: 540px; margin: 0 auto 2rem; }
.badge-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 3rem; }
.badge { background: var(--bg2); border: 1px solid var(--border2); color: var(--text2); padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; display: flex; align-items: center; gap: 6px; }
.badge .dot { width: 6px; height: 6px; background: var(--primary); border-radius: 50%; }

/* === cards === */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 1.25rem; display: flex; align-items: center; gap: 8px; color: var(--text); }
.card-title svg { color: var(--primary); }

/* === swap form === */
.swap-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); }
.field-label { font-size: 0.75rem; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.input-group { display: flex; gap: 8px; margin-bottom: 1rem; }
.input-group input[type="number"] {
    flex: 1; background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius-sm);
    padding: 12px 14px; font-size: 1.1rem; font-weight: 600; color: var(--text);
    outline: none; transition: border-color .2s;
}
.input-group input[type="number"]:focus { border-color: var(--primary); }
.currency-selector {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px;
    background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius-sm);
    color: var(--text); cursor: pointer; white-space: nowrap; font-size: 0.95rem; font-weight: 600;
    transition: border-color .2s; min-width: 110px;
}
.currency-selector:hover { border-color: var(--primary); }
.coin-dot { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.output-box {
    flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px 14px; font-size: 1.1rem; font-weight: 600; color: var(--primary); min-height: 48px;
    display: flex; align-items: center;
}
.swap-divider { display: flex; align-items: center; gap: 1rem; margin: 0.5rem 0; }
.swap-divider hr { flex: 1; border: none; border-top: 1px solid var(--border); }
.swap-icon-btn {
    width: 38px; height: 38px; border-radius: 50%; background: var(--bg3); border: 1px solid var(--border2);
    cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text2);
    transition: all .2s; flex-shrink: 0;
}
.swap-icon-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; transform: rotate(180deg); }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--bg); border-radius: var(--radius-sm); margin: 1rem 0; font-size: 0.85rem; }
.info-row span { color: var(--text2); }
.info-row strong { color: var(--text); }

/* === buttons === */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 24px; border-radius: var(--radius-sm); font-size: 1rem; font-weight: 600; cursor: pointer; transition: all .2s; border: none; }
.btn-primary { background: var(--primary); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline { background: transparent; border: 1px solid var(--border2); color: var(--text2); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* === tabs === */
.tabs { display: flex; background: var(--bg); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 1.25rem; }
.tab { flex: 1; padding: 8px; text-align: center; cursor: pointer; border-radius: 6px; font-size: 0.85rem; font-weight: 500; color: var(--text2); transition: all .2s; }
.tab.active { background: var(--bg2); color: var(--text); }

/* === stats === */
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; text-align: center; }
.stat-card .num { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-card .lbl { font-size: 0.8rem; color: var(--text2); margin-top: 4px; }

/* === transaction table === */
.tx-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tx-table th { padding: 10px 12px; text-align: left; color: var(--text3); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
.tx-table td { padding: 12px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.tx-table tr:last-child td { border-bottom: none; }
.tx-table tr:hover td { background: rgba(255,255,255,0.02); }
.status { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.status-waiting  { background: rgba(251,191,36,0.15); color: #fbbf24; }
.status-exchanging { background: rgba(59,130,246,0.15); color: #60a5fa; }
.status-finished { background: rgba(34,197,94,0.15); color: #22c55e; }
.status-failed   { background: rgba(239,68,68,0.15); color: #f87171; }
.status-refunded { background: rgba(148,163,184,0.15); color: #94a3b8; }

/* === modal === */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 200; align-items: center; justify-content: center; padding: 1rem; }
.modal-bg.open { display: flex; }
.modal { background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius); padding: 1.5rem; width: 100%; max-width: 400px; max-height: 80vh; display: flex; flex-direction: column; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-search { width: 100%; margin-bottom: 12px; }
.modal-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.coin-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: background .15s; }
.coin-item:hover { background: var(--bg3); }
.coin-item .name { font-size: 0.85rem; color: var(--text2); }

/* === deposit modal === */
.deposit-info { background: var(--bg); border-radius: var(--radius-sm); padding: 1rem; margin: 1rem 0; }
.address-box { font-family: monospace; font-size: 0.8rem; word-break: break-all; color: var(--primary); padding: 10px; background: var(--bg2); border-radius: 6px; border: 1px solid var(--border); margin-top: 6px; cursor: pointer; }
.qr-placeholder { width: 120px; height: 120px; background: #fff; border-radius: 8px; margin: 0 auto 1rem; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; color: #333; }

/* === features section === */
.features { padding: 4rem 0; }
.features h2 { text-align: center; font-size: 1.8rem; font-weight: 700; margin-bottom: 0.5rem; }
.features .sub { text-align: center; color: var(--text2); margin-bottom: 3rem; }
.feature-card { padding: 1.5rem; }
.feature-icon { width: 48px; height: 48px; background: rgba(34,197,94,0.1); border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; color: var(--primary); }
.feature-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.9rem; color: var(--text2); }

/* === footer === */
footer { border-top: 1px solid var(--border); padding: 2rem 0; margin-top: 4rem; text-align: center; color: var(--text3); font-size: 0.85rem; }
footer a { color: var(--text2); text-decoration: none; }
footer a:hover { color: var(--primary); }

/* === loading spinner === */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === alert === */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.875rem; margin: 1rem 0; }
.alert-error   { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }
.alert-success { background: rgba(34,197,94,0.1);  border: 1px solid rgba(34,197,94,0.3);  color: #22c55e; }
.alert-info    { background: rgba(59,130,246,0.1);  border: 1px solid rgba(59,130,246,0.3);  color: #60a5fa; }

/* === page sections === */
.section { padding: 3rem 0; }
.page-header { padding: 3rem 0 2rem; }
.page-header h1 { font-size: 2rem; font-weight: 700; }
.page-header p  { color: var(--text2); margin-top: 0.5rem; }
