* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f6f8fb;
    --panel: #ffffff;
    --panel2: #f8fafc;
    --border: #e2e8f0;
    --text: #1a2433;
    --muted: #64748b;
    --accent: #4168e0;
    --accent-soft: #eef2fe;
    --gold: #f0b90b;
    --green: #16a34a;
    --red: #dc2626;
    --navy: #0e1626;
    --navy2: #16213b;
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--panel2); border: 1px solid var(--border); padding: 2px 6px; border-radius: 5px; font-size: 0.9em; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; width: 100%; }
.hidden { display: none !important; }

/* ===== header ===== */
.topbar { background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 55%, #1d3a5f 100%); position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 12px rgba(14, 22, 38, 0.35); }
.topbar-inner { display: flex; align-items: center; gap: 22px; padding: 12px 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-logo {
    width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, var(--gold), #f7d95e);
    display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px; color: var(--navy);
    box-shadow: 0 0 18px rgba(240, 185, 11, 0.4);
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: 0.2px; }
.brand-slogan { font-size: 11px; color: #8fa3c8; letter-spacing: 1.1px; text-transform: uppercase; }
.search { flex: 1; display: flex; gap: 0; max-width: 560px; min-width: 240px; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.2); }
.search input { flex: 1; border: none; color: var(--text); padding: 11px 15px; font-size: 14px; outline: none; background: transparent; }
.search button { background: var(--accent); border: none; color: #fff; padding: 0 20px; font-weight: 600; cursor: pointer; font-size: 14px; }
.search button:hover { filter: brightness(1.08); }
.actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.btn-connect {
    display: inline-flex; align-items: center; gap: 8px; background: #fff; color: var(--navy); border: none;
    border-radius: 10px; padding: 10px 16px; font-weight: 700; cursor: pointer; font-size: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.btn-connect:hover { background: var(--gold); }
.btn-ghost { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2); color: #dbe6ff; border-radius: 10px; padding: 9px 15px; cursor: pointer; font-size: 13px; }
.btn-ghost:hover { background: rgba(255,255,255,0.16); color: #fff; text-decoration: none; }

.chainbar { background: rgba(0,0,0,0.25); border-top: 1px solid rgba(255,255,255,0.08); }
.chainbar .container { display: flex; gap: 10px; padding: 7px 16px; flex-wrap: wrap; align-items: center; }
.chain-pill { color: #b8c6e0; font-size: 12px; padding: 4px 12px; border-radius: 20px; background: rgba(255,255,255,0.07); }
.chain-pill-gold { background: rgba(240, 185, 11, 0.18); color: #ffd54a; font-weight: 600; }
#walletStatus { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== main ===== */
main.container { flex: 1; padding-top: 26px; padding-bottom: 48px; }

/* hero */
.hero { background: linear-gradient(135deg, #0e1626, #1d3a5f); border-radius: 16px; padding: 34px 28px; margin-bottom: 26px; color: #fff; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(240,185,11,0.22), transparent 65%); }
.hero h1 { font-size: 28px; font-weight: 800; }
.hero .tagline { color: var(--gold); font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; font-size: 12px; margin-bottom: 8px; }
.hero p { color: #b8c6e0; margin-top: 8px; max-width: 640px; font-size: 15px; }

/* stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.stat-card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
.stat-card .value { font-size: 22px; font-weight: 700; margin-top: 6px; color: var(--navy); }
.stat-card .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* panels */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 920px) { .grid-2 { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.panel h2 { font-size: 15px; font-weight: 700; padding: 14px 18px; border-bottom: 1px solid var(--border); color: var(--navy); display: flex; align-items: center; justify-content: space-between; }
.panel h2 a { font-size: 12px; font-weight: 500; }
.panel-body { padding: 6px 0; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 18px; font-size: 13px; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; border-bottom: 1px solid var(--border); background: var(--panel2); }
tbody tr { border-bottom: 1px solid #eef2f7; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--panel2); }
.mono { font-family: "SF Mono", Consolas, "Courier New", monospace; }
.hash { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
.tx-in { color: var(--green); font-weight: 600; }
.tx-out { color: var(--red); font-weight: 600; }
.muted { color: var(--muted); }
.amount { font-weight: 600; color: var(--navy); }

/* badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; vertical-align: middle; }
.badge-verified { background: #e6f7ed; color: var(--green); border: 1px solid #bdebd0; }
.badge-unverified { background: #fef3e2; color: #b45309; border: 1px solid #fde6bd; }
.badge-contract { background: var(--accent-soft); color: var(--accent); border: 1px solid #d4ddfa; }
.badge-wallet { background: #f0f4f9; color: var(--muted); border: 1px solid var(--border); }
.badge-status-ok { background: #e6f7ed; color: var(--green); }
.badge-status-err { background: #feeeee; color: var(--red); }

/* detail cards */
.detail-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.detail-row { display: flex; padding: 11px 0; border-bottom: 1px solid #eef2f7; gap: 20px; flex-wrap: wrap; }
.detail-row:last-child { border-bottom: none; }
.detail-row .k { width: 190px; color: var(--muted); flex-shrink: 0; font-size: 13px; }
.detail-row .v { flex: 1; word-break: break-all; font-size: 14px; }

.tab-title { font-size: 24px; font-weight: 800; margin-bottom: 18px; color: var(--navy); }

/* faucet */
.faucet-box { max-width: 580px; margin: 0 auto; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 32px; text-align: center; box-shadow: var(--shadow); }
.faucet-box h1 { font-size: 26px; margin-bottom: 8px; color: var(--navy); }
.faucet-box p { color: var(--muted); margin-bottom: 22px; }
.faucet-box input {
    width: 100%; background: #fff; border: 1px solid var(--border); color: var(--text);
    border-radius: 10px; padding: 14px 16px; font-size: 15px; outline: none; font-family: monospace; margin-bottom: 16px;
}
.faucet-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(65,104,224,0.12); }
.btn-primary {
    width: 100%; background: linear-gradient(135deg, var(--accent), #6d5df0); border: none; color: #fff;
    border-radius: 10px; padding: 14px; font-size: 16px; font-weight: 700; cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.alert { padding: 13px 17px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; text-align: left; }
.alert-ok { background: #e6f7ed; border: 1px solid #bdebd0; color: var(--green); }
.alert-err { background: #feeeee; border: 1px solid #f5c6c6; color: var(--red); }
.alert-info { background: var(--accent-soft); border: 1px solid #d4ddfa; color: var(--accent); }

/* tokens */
.token-logo { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #6d5df0); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; vertical-align: middle; margin-right: 10px; flex-shrink: 0; }
.token-cell { display: flex; align-items: center; }
.price-up { color: var(--green); }
.price-down { color: var(--red); }

/* admin */
.admin-card { max-width: 760px; margin: 0 auto; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.form-grid input, .form-grid textarea, .form-grid select {
    width: 100%; background: #fff; border: 1px solid var(--border); color: var(--text);
    border-radius: 8px; padding: 11px 13px; font-size: 14px; outline: none;
}
.form-grid input:focus, .form-grid textarea:focus, .form-grid select:focus { border-color: var(--accent); }
.form-full { grid-column: 1 / -1; }
.btn-secondary { background: var(--accent); border: none; color: #fff; border-radius: 8px; padding: 11px 20px; font-weight: 600; cursor: pointer; margin-top: 12px; font-size: 14px; }
.btn-secondary:hover { filter: brightness(1.08); }
.btn-danger { background: #feeeee; color: var(--red); border: 1px solid #f5c6c6; border-radius: 8px; padding: 6px 12px; font-weight: 600; cursor: pointer; font-size: 12px; }

/* modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(10, 16, 28, 0.6); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(2px); }
.modal { background: #fff; border-radius: 16px; width: 420px; max-width: 92vw; box-shadow: 0 20px 60px rgba(0,0,0,0.3); overflow: hidden; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 17px; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 26px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 18px 22px 22px; }
.wallet-option { display: flex; align-items: center; gap: 13px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.wallet-option:hover { border-color: var(--accent); background: var(--panel2); }
.wallet-option img { width: 30px; height: 30px; border-radius: 8px; background: #fff; object-fit: contain; }
.wallet-option span { font-weight: 600; flex: 1; }
.wallet-tag { font-size: 11px; color: var(--green); background: #e6f7ed; padding: 2px 8px; border-radius: 20px; font-weight: 700; }

/* address checker */
.address-checker { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-bottom: 24px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.address-checker input { flex: 1; min-width: 260px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 15px; font-size: 14px; outline: none; font-family: monospace; }
.address-checker input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(65,104,224,0.12); }
.address-checker button { background: var(--navy); color: #fff; border: none; border-radius: 10px; padding: 12px 22px; font-weight: 700; cursor: pointer; }
.address-checker button:hover { background: var(--accent); }

/* pager / spinner */
.pager { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.pager button { background: #fff; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 8px 16px; cursor: pointer; }
.pager button:hover { border-color: var(--accent); }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.spinner { text-align: center; padding: 46px; color: var(--muted); }
.spinner::before { content: ""; display: inline-block; width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 10px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* footer */
footer.footer { border-top: 1px solid var(--border); background: #fff; padding: 24px 0; }
.footer-grid { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-brand { font-weight: 800; color: var(--navy); margin-bottom: 6px; }
.footer-brand small { color: var(--muted); font-weight: 500; font-size: 12px; }
.footer-links { display: flex; gap: 18px; }
.footer-links a { color: var(--muted); font-size: 13px; }
.footer-links a:hover { color: var(--accent); }
