:root {
  --bg: #0f1115;
  --bg2: #16181d;
  --card: #1c1f26;
  --border: #2a2e37;
  --muted: #8a919e;
  --text: #e7ebf2;
  --teal: #2dd4bf;
  --violet: #8b5cf6;
  --danger: #f05252;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', 'Vazirmatn', sans-serif;
  overflow: hidden;
}
#root, .app-root { height: 100vh; }
.boot { height: 100vh; background: var(--bg); }

.fade-in { animation: fadeIn .45s ease both; }
.fade-out { animation: fadeOut .4s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; transform: scale(.98); } }

/* ===== LOGIN ===== */
.login-wrap {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 20%, #1a1d26 0%, #0b0d11 70%);
  overflow: hidden;
  padding: 20px;
}
.login-grid-bg {
  position: absolute; inset: -50%;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 44px 44px;
  transform: perspective(500px) rotateX(55deg);
  animation: gridMove 18s linear infinite;
}
@keyframes gridMove { from { background-position: 0 0; } to { background-position: 0 88px; } }
.login-glow {
  position: absolute;
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(45,212,191,.18), rgba(139,92,246,.12), transparent 70%);
  filter: blur(40px);
  top: 10%;
  animation: pulse 6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity:.7; transform: scale(1);} 50% { opacity:1; transform: scale(1.1);} }

.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, rgba(28,31,38,.95), rgba(20,22,28,.95));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 34px 30px 26px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.04);
  backdrop-filter: blur(6px);
  text-align: center;
}
.shake { animation: shake .45s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%,90% { transform: translateX(-2px); }
  20%,80% { transform: translateX(4px); }
  30%,50%,70% { transform: translateX(-8px); }
  40%,60% { transform: translateX(8px); }
}
.lock-badge {
  width: 60px; height: 60px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--teal), var(--violet));
  color: #0b0d11;
  box-shadow: 0 8px 24px rgba(45,212,191,.3);
}
.login-title-fa {
  font-family: 'Vazirmatn', sans-serif;
  font-weight: 700;
  font-size: 26px;
  margin: 0 0 2px;
  letter-spacing: 1px;
  background: linear-gradient(90deg, var(--teal), var(--violet));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-title-en {
  font-weight: 300; font-size: 13px; letter-spacing: 3px;
  text-transform: uppercase; color: var(--muted); margin: 0 0 14px;
}
.login-tag { color: var(--muted); font-size: 13px; margin: 0 0 22px; font-weight: 300; }

.field {
  display: flex; align-items: center;
  background: #12141a;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 12px;
  margin-bottom: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.field:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45,212,191,.12);
}
.field-icon { color: var(--muted); display: flex; }
.field-input {
  flex: 1;
  background: transparent;
  border: none; outline: none;
  color: var(--text);
  padding: 13px 10px;
  font-size: 15px;
  font-family: 'JetBrains Mono', monospace;
}
.field-input::placeholder { color: #565d6b; font-family: 'Space Grotesk', sans-serif; }
.eye-btn { background: none; border: none; cursor: pointer; font-size: 16px; opacity: .8; }

.err-msg {
  color: var(--danger);
  background: rgba(240,82,82,.1);
  border: 1px solid rgba(240,82,82,.3);
  border-radius: 10px;
  padding: 9px;
  font-size: 13px;
  margin-bottom: 14px;
  font-family: 'Vazirmatn', sans-serif;
}
.unlock-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--teal), var(--violet));
  color: #0b0d11;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s;
  box-shadow: 0 8px 24px rgba(139,92,246,.3);
  font-family: 'Vazirmatn', sans-serif;
}
.unlock-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(139,92,246,.45); }
.unlock-btn:active { transform: translateY(0) scale(.98); }
.login-foot { color: #565d6b; font-size: 11px; margin: 18px 0 0; letter-spacing: 1px; }

.remix-link-abs {
  position: absolute; bottom: 14px; left: 0; right: 0;
  text-align: center; z-index: 2;
  color: var(--muted); font-size: 12px; text-decoration: none;
}
.remix-link-abs:hover { color: var(--teal); }

/* ===== CONSOLE ===== */
.console-wrap {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.console-nav {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand-lock { font-size: 18px; }
.brand-name {
  font-weight: 700; letter-spacing: .5px;
  background: linear-gradient(90deg, var(--teal), var(--violet));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.addr-row {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 240px;
}
.icon-btn {
  background: #12141a; border: 1px solid var(--border);
  color: var(--text); border-radius: 10px;
  width: 38px; height: 38px; cursor: pointer; font-size: 16px;
  transition: background .2s;
}
.icon-btn:hover { background: #1d212a; }
.addr-box {
  flex: 1;
  display: flex; align-items: center;
  background: #12141a;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  transition: border-color .2s, box-shadow .2s;
}
.addr-box:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(45,212,191,.1); }
.globe-icon { color: var(--muted); display: flex; }
.addr-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); padding: 10px 10px; font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
}
.addr-input::placeholder { color: #565d6b; font-family: 'Space Grotesk', sans-serif; }
.go-btn {
  background: linear-gradient(90deg, var(--teal), var(--violet));
  color: #0b0d11; border: none; border-radius: 10px;
  padding: 0 16px; height: 38px; font-weight: 700; cursor: pointer;
  white-space: nowrap; transition: transform .15s;
}
.go-btn:hover { transform: translateY(-1px); }
.logout-btn {
  background: rgba(240,82,82,.12);
  color: var(--danger);
  border: 1px solid rgba(240,82,82,.35);
  border-radius: 10px; padding: 0 14px; height: 38px;
  cursor: pointer; white-space: nowrap; font-family: 'Vazirmatn', sans-serif;
  transition: background .2s;
}
.logout-btn:hover { background: rgba(240,82,82,.22); }

.mode-btn {
  border: 1px solid var(--border);
  border-radius: 10px; padding: 0 12px; height: 38px;
  cursor: pointer; white-space: nowrap; font-weight: 700; font-size: 13px;
  transition: all .2s;
}
.mode-proxy {
  background: rgba(45,212,191,.14); color: var(--teal);
  border-color: rgba(45,212,191,.4);
}
.mode-proxy:hover { background: rgba(45,212,191,.24); }
.mode-direct {
  background: rgba(139,92,246,.14); color: #b79bff;
  border-color: rgba(139,92,246,.4);
}
.mode-direct:hover { background: rgba(139,92,246,.24); }

.status-tag {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 10px; white-space: nowrap;
}
.error-banner {
  background: rgba(240,82,82,.1);
  border-bottom: 1px solid rgba(240,82,82,.3);
  color: #ffb3b3;
}
.error-banner .banner-close { color: #ffb3b3; }
.empty-hint {
  font-size: 12px; margin: 14px 0 0; color: #565d6b;
  max-width: 380px; line-height: 1.5;
}

.quick-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; background: var(--bg2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto; white-space: nowrap;
}
.quick-label { color: var(--muted); font-size: 12px; letter-spacing: 1px; }
.quick-chip {
  background: #12141a; border: 1px solid var(--border);
  color: var(--text); border-radius: 999px;
  padding: 5px 14px; font-size: 12px; cursor: pointer;
  transition: all .2s;
}
.quick-chip:hover { border-color: var(--teal); color: var(--teal); }

.info-banner {
  display: flex; align-items: center; gap: 12px;
  background: rgba(139,92,246,.1);
  border-bottom: 1px solid rgba(139,92,246,.25);
  color: #c4b5fd;
  padding: 8px 14px; font-size: 12.5px;
}
.info-banner span { flex: 1; }
.open-tab { color: var(--teal); text-decoration: none; font-weight: 700; white-space: nowrap; }
.banner-close {
  background: none; border: none; color: #c4b5fd;
  cursor: pointer; font-size: 14px;
}

.viewport {
  position: relative;
  flex: 1;
  background: #0a0c0f;
  overflow: hidden;
}
.loading-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--violet), var(--teal));
  background-size: 200% 100%;
  animation: loadSlide 1s linear infinite;
  z-index: 5;
}
@keyframes loadSlide { from { background-position: 0 0; } to { background-position: -200% 0; } }
.site-frame { width: 100%; height: 100%; border: none; background: #fff; }

.empty-state {
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--muted); text-align: center;
}
.globe-big { font-size: 70px; margin-bottom: 14px; animation: float 4s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-10px);} }
.empty-title { font-size: 17px; margin: 0 0 6px; color: var(--text); }
.empty-sub { font-family: 'Vazirmatn', sans-serif; font-size: 13px; margin: 0; }

.console-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 14px; background: var(--bg2);
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--muted);
}
.console-footer a { color: var(--muted); text-decoration: none; }
.console-footer a:hover { color: var(--teal); }

@media (max-width: 640px) {
  .addr-row { order: 3; width: 100%; flex-wrap: wrap; }
  .addr-box { min-width: 140px; }
  .logout-btn { order: 2; margin-left: auto; }
  .console-nav { gap: 8px; }
}