:root {
  --bg: #080604;
  --bg-secondary: #0e0c08;
  --card: #12100a;
  --card-hover: #1a1610;
  --border: rgba(218, 165, 32, 0.15);
  --border-subtle: rgba(218, 165, 32, 0.06);
  --text: #f5edd6;
  --text-secondary: #c4b898;
  --muted: #8a7d65;
  --gold: #daa520;
  --gold-light: #ffd700;
  --gold-warm: #e8b923;
  --gold-dark: #b8860b;
  --gold-deep: #8b6914;
  --green: #5eead4;
  --red: #f87171;
  --glow-gold: rgba(255, 215, 0, 0.08);
  --glow-gold-strong: rgba(255, 215, 0, 0.15);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-gold: 0 2px 20px rgba(218, 165, 32, 0.1), 0 0 60px rgba(218, 165, 32, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(218, 165, 32, 0.07), transparent 60%),
    radial-gradient(ellipse 40% 40% at 20% 20%, rgba(255, 215, 0, 0.03), transparent),
    radial-gradient(ellipse 30% 30% at 80% 15%, rgba(184, 134, 11, 0.04), transparent);
  z-index: -1;
}

/* ===== HEADER ===== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 5vw;
  position: sticky;
  top: 0;
  background: rgba(8, 6, 4, 0.94);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo img {
  height: 34px;
  width: auto;
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.3));
}

.logo-text {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  background: linear-gradient(160deg, var(--gold-light) 0%, var(--gold) 40%, var(--gold-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.25s;
  position: relative;
}

.nav-links a:hover {
  color: var(--gold-light);
}

.nav-links a:hover::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gold);
  opacity: 0.5;
}

/* ===== BUTTONS ===== */
.btn {
  background: linear-gradient(160deg, var(--gold-light), var(--gold), var(--gold-dark));
  color: #0a0804;
  border: none;
  padding: 10px 22px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.25s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255,255,255,0.15), transparent 50%);
  pointer-events: none;
}

.btn:hover {
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3), 0 0 40px rgba(218, 165, 32, 0.15);
  transform: translateY(-1px);
}

.btn.ghost {
  background: transparent;
  color: var(--gold);
  border: 1px solid rgba(218, 165, 32, 0.25);
}

.btn.ghost::before { display: none; }

.btn.ghost:hover {
  border-color: var(--gold);
  background: rgba(218, 165, 32, 0.06);
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.08);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.78rem;
  border-radius: 6px;
}

/* ===== CONTAINER ===== */
.container {
  padding: 48px 5vw 80px;
  display: flex;
  flex-direction: column;
  gap: 56px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ===== HERO ===== */
.hero {
  display: grid;
  gap: 40px;
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

.eyebrow {
  text-transform: uppercase;
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  font-weight: 600;
  margin-bottom: 14px;
  text-shadow: 0 0 12px rgba(218, 165, 32, 0.3);
}

.hero h1 {
  font-size: clamp(2.2rem, 3.5vw, 3.2rem);
  margin: 0 0 14px;
  font-weight: 800;
  line-height: 1.08;
  background: linear-gradient(160deg, #fff 20%, var(--gold-light) 50%, var(--gold) 80%, var(--gold-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtext {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.65;
  max-width: 460px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 28px;
}

.stat {
  background: linear-gradient(160deg, var(--card), rgba(218, 165, 32, 0.03));
  border: 1px solid var(--border);
  padding: 16px 14px;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.stat::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dark), transparent);
  opacity: 0.4;
}

.stat .label {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: block;
}

.stat .value {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 6px;
  display: block;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-cta {
  margin-top: 24px;
}

/* ===== TOP CARDS ===== */
.hero-panel {
  background: linear-gradient(160deg, var(--card), rgba(218, 165, 32, 0.02));
  border: 1px solid var(--border);
  padding: 22px;
  border-radius: 14px;
  box-shadow: var(--shadow-gold);
  position: relative;
  overflow: hidden;
}

.hero-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 10%, var(--gold) 50%, transparent 90%);
  opacity: 0.3;
}

.hero-panel h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 16px;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px 16px;
  transition: all 0.25s;
}

.card:hover {
  border-color: rgba(218, 165, 32, 0.2);
  background: var(--card-hover);
  box-shadow: 0 0 16px rgba(218, 165, 32, 0.05);
}

.card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.card p {
  margin: 3px 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.card .trade-link {
  display: inline-block;
  margin-top: 6px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

.card .trade-link:hover {
  color: var(--gold-light);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.card .trade-link.hl-link {
  margin-left: 12px;
  color: var(--green);
}

.card .trade-link.hl-link:hover {
  color: #7df5d4;
}

/* ===== SECTIONS ===== */
.section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.section-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

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

.status {
  color: var(--muted);
  font-size: 0.78rem;
}

/* ===== TABLE ===== */
.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  position: relative;
}

.table-wrap::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dark), transparent);
  opacity: 0.25;
  z-index: 1;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  min-width: 750px;
}

th, td {
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.86rem;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  background: rgba(218, 165, 32, 0.02);
  user-select: none;
  transition: color 0.2s;
}

th:hover {
  color: var(--gold);
}

tr:hover td {
  background: rgba(218, 165, 32, 0.02);
}

td strong {
  color: var(--text);
}

td .trade-btn {
  color: var(--gold);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.82rem;
  transition: all 0.2s;
}

td .trade-btn:hover {
  color: var(--gold-light);
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.25);
}

td .trade-btn.hl-btn {
  margin-left: 8px;
  color: var(--green);
}

td .trade-btn.hl-btn:hover {
  color: #7df5d4;
  text-shadow: 0 0 6px rgba(94, 234, 212, 0.25);
}

.positive { color: var(--green); }
.negative { color: var(--red); }
.neutral { color: var(--muted); }

.oi-cell { font-size: 0.8rem; color: var(--text-secondary); }
.oi-label { color: var(--muted); font-size: 0.7rem; font-weight: 600; }

.zero-fee { 
  color: var(--green); 
  font-size: 0.65rem; 
  font-weight: 700; 
  padding: 2px 6px;
  background: rgba(94, 234, 212, 0.08);
  border: 1px solid rgba(94, 234, 212, 0.15);
  border-radius: 4px;
  margin-left: 4px;
}

.zero-fee-badge {
  background: rgba(94, 234, 212, 0.1) !important;
  color: var(--green) !important;
  border-color: rgba(94, 234, 212, 0.2) !important;
  margin-left: 6px;
}

.strategy-cell { font-size: 0.78rem; }
.short-label { color: var(--red); font-weight: 700; font-size: 0.7rem; }
.long-label { color: var(--green); font-weight: 700; font-size: 0.7rem; margin-left: 6px; }

.rates-line { font-size: 0.78rem; color: var(--text-secondary); }
.card-links { display: flex; gap: 12px; margin-top: 6px; }

td .trade-btn.lighter-btn {
  margin-left: 8px;
  color: #a78bfa;
}
td .trade-btn.lighter-btn:hover {
  color: #c4b5fd;
  text-shadow: 0 0 6px rgba(167, 139, 250, 0.25);
}

.card .trade-link.lighter-link {
  color: #a78bfa;
}
.card .trade-link.lighter-link:hover {
  color: #c4b5fd;
}

td .trade-btn.extended-btn {
  margin-left: 8px;
  color: #60a5fa;
}
td .trade-btn.extended-btn:hover {
  color: #93c5fd;
  text-shadow: 0 0 6px rgba(96, 165, 250, 0.25);
}

.card .trade-link.extended-link {
  color: #60a5fa;
}
.card .trade-link.extended-link:hover {
  color: #93c5fd;
}

td .trade-btn.binance-btn {
  margin-left: 8px;
  color: #f0b90b;
}
td .trade-btn.binance-btn:hover {
  color: #fcd535;
  text-shadow: 0 0 6px rgba(240, 185, 11, 0.25);
}

td .trade-btn.bybit-btn {
  margin-left: 8px;
  color: #f7a600;
}
td .trade-btn.bybit-btn:hover {
  color: #ffbe2e;
  text-shadow: 0 0 6px rgba(247, 166, 0, 0.25);
}

.trade-cell {
  white-space: nowrap;
}

td .trade-btn.orderly-btn {
  color: var(--gold);
}

/* ===== BADGE ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(218, 165, 32, 0.1);
  color: var(--gold-light);
  border: 1px solid rgba(218, 165, 32, 0.18);
}

.badge.direction {
  font-size: 0.68rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}

/* ===== CALCULATOR ===== */
.calculator {
  background: linear-gradient(160deg, var(--card), rgba(218, 165, 32, 0.02));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  align-items: end;
  position: relative;
  overflow: hidden;
}

.calculator::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dark), transparent);
  opacity: 0.25;
}

.field label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  font-weight: 500;
}

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
  transition: all 0.25s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(218, 165, 32, 0.1), 0 0 16px rgba(218, 165, 32, 0.06);
}

.calc-results {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.calc-results .badge {
  text-align: center;
  padding: 12px;
  font-size: 0.82rem;
}

/* ===== GOLD DIVIDER ===== */
.gold-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.2;
}

/* ===== FOOTER ===== */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 5vw;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--gold);
}

/* ===== ANIMATIONS ===== */
.refresh-animate {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .site-header { flex-wrap: wrap; gap: 12px; }
  .nav-links { gap: 16px; }
  .site-footer { flex-direction: column; gap: 12px; align-items: flex-start; }
  .calculator { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .hero-stats { grid-template-columns: 1fr; }
  .calculator { grid-template-columns: 1fr; }
}
