:root {
  /* شادتر و روشن‌تر */
  --bg: #0c1222;              /* پس‌زمینه کلی */
  --panel: #151c2f;           /* پنل‌ها */
  --panel-soft: #1a2340;
  --text: #ecf0ff;            /* متن اصلی */
  --muted: #b9c2e1;           /* متن کم‌رنگ */
  --primary: #53e1c3;         /* سبز آبی شاد */
  --accent: #8aa4ff;          /* آبی ملایم */
  --pink: #ff9ad6;
  --orange: #ffb774;
  --cyan: #6fe6ff;
  --purple: #c9b6ff;
  --ok: #2de37d;
  --warn: #ffd166;
  --danger: #ff6b6b;
  --border: #2a3453;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 15% 10%, #1d2950 0%, transparent 60%),
    radial-gradient(1000px 600px at 85% 0%, #243264 0%, transparent 55%),
    var(--bg);
}

/* Landing (Gate) */
.gate { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(12,18,34,.85); backdrop-filter: blur(4px); z-index: 9998; }
.gate.active { display: flex; }
.gate-card { width: min(520px, 92vw); background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 24px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.gate-card .logo { width: 80px; height: 80px; object-fit: contain; margin-bottom: 8px; filter: drop-shadow(0 4px 10px rgba(0,0,0,.3)); }
.logo.small { width: 28px; height: 28px; margin-right: 10px; }

.gate-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.small { font-size: 12px; }

/* Loader (global) */
.loader { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(12,18,34,.6); z-index: 9999; }
.loader.hidden { display: none; }
.spinner { width: 44px; height: 44px; border: 4px solid #2a3453; border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; vertical-align: -3px; margin-right: 6px; }
.loading-text { color: var(--muted); font-size: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* Header */
.app-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, #111835, #162042);
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: .3px; }
.brand-sub { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.net-pill {
  background: rgba(138,164,255,.15); color: #bcd1ff;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; border: 1px solid rgba(138,164,255,.4);
}

/* Tabs */
.tabs { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: linear-gradient(90deg, rgba(83,225,195,.08), rgba(138,164,255,.08)); }
.tab {
  background: rgba(255,255,255,.04); color: var(--text); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; transition: all .15s ease;
}
.tab:hover { background: rgba(255,255,255,.08); }
.tab.active { background: linear-gradient(90deg, rgba(83,225,195,.2), rgba(138,164,255,.2)); border-color: rgba(83,225,195,.35); }

main { padding: 14px; max-width: 1100px; margin: 0 auto; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 14px; box-shadow: 0 10px 24px rgba(0,0,0,.2);
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.box { background: var(--panel-soft); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.kv { display: flex; justify-content: space-between; border-bottom: 1px dashed #31406b; padding: 6px 0; }
.kv span { color: var(--muted); }
code { background: #0f1733; color: #cfe2ff; padding: 2px 6px; border-radius: 6px; border: 1px solid #2a3453; }

/* Inputs & Labels */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, select {
  width: 100%; background: #0f1833; color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px;
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus { border-color: rgba(83,225,195,.6); box-shadow: 0 0 0 4px rgba(83,225,195,.12); }
.muted { color: var(--muted); font-size: 12px; }

/* Buttons */
button {
  border: none; border-radius: 12px; padding: 10px 14px; cursor: pointer;
  background: #243255; color: var(--text); transition: transform .05s ease, background .15s ease;
}
button:hover { transform: translateY(-1px); }
button.primary { background: linear-gradient(90deg, #53e1c3, #8aa4ff); color: #0a0f12; font-weight: 700; }
button.secondary { background: #2a3a6a; }
button.ghost { background: transparent; border: 1px solid var(--border); }
button.danger { background: #ef5350; color: white; }
button.mini { padding: 6px 10px; border-radius: 9px; font-size: 13px; }
.btn-loading { pointer-events: none; opacity: .75; }

/* Tabs visibility */
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Steps */
.step-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 720px) { .step-grid { grid-template-columns: 1fr; } }
.step-card {
  border-radius: 14px; padding: 12px; text-align: center; font-weight: 800; color: #0b1117;
  display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .15s ease, transform .05s ease;
}
.step-card.off { background: #223057; color: #bfc8e8; box-shadow: inset 0 0 0 2px rgba(255,255,255,.06); }
.step-ds1:not(.off) { background: #7df0d6; }
.step-ul1:not(.off) { background: #9eb3ff; }
.step-eq1:not(.off) { background: #dfc9ff; }
.step-ds2:not(.off) { background: #ffc894; }
.step-ul2:not(.off) { background: #a2f2ff; }
.step-eq2:not(.off) { background: #ffb8e6; }
.step-card.off .step-actions { display: block; }
.step-card:not(.off) .step-actions { display: none; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px dashed #31406b; text-align: left; padding: 8px; font-size: 14px; }
.table th { color: #d7e2ff; font-weight: 700; }

/* Diagram (2 levels, absolute layout) */
.diagram-wrapper { position: relative; width: 100%; }
#treeLines { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.tree { position: relative; min-height: 280px; }  /* container برای قرار دادن نودهای absolute */
.node {
  position: absolute;
  background: #121a38; border: 1px solid #31406b; border-radius: 12px;
  padding: 10px; text-align: center; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
  width: 120px; height: 64px; justify-content: center;
  box-shadow: 0 6px 14px rgba(0,0,0,.2);
}
.node .id { font-weight: 800; color: #7df0d6; font-size: 13px; }
.node .name { color: #b9c2e1; font-size: 12px; }
.node.empty { opacity: 0.38; cursor: default; }
.node.direct { border-color: rgba(83,225,195,.9); box-shadow: 0 0 0 3px rgba(83,225,195,.25), 0 8px 18px rgba(0,0,0,.25); }

/* Claim Explorer */
.claim-nav {
  display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 8px;
}
.claim-label { display: flex; align-items: baseline; gap: 10px; }
.claim-label code { background: #0f1733; border: 1px solid #2a3453; }

/* Node Modal status dots */
.status-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.status-item {
  background: #121a38; border: 1px solid #31406b; border-radius: 10px;
  padding: 8px; display: flex; align-items: center; gap: 8px;
}
.dot {
  width: 12px; height: 12px; border-radius: 999px; background: #48527a; border: 1px solid #2a3453; box-shadow: inset 0 0 6px rgba(0,0,0,.35);
}
.dot.on { background: #2de37d; border-color: #2de37d; box-shadow: 0 0 8px rgba(45,227,125,.55); }
.dot.warn { background: #ffd166; border-color: #ffd166; box-shadow: 0 0 8px rgba(255,209,102,.55); }

/* Dialog */
dialog {
  border: 1px solid var(--border); border-radius: 16px; background: var(--panel); color: var(--text); padding: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}