/* Empyrea Tunnel — тёмная фэнтези-тема */
:root {
  --bg: #0b0f1c;
  --bg2: #101627;
  --card: rgba(255, 255, 255, 0.035);
  --border: rgba(255, 255, 255, 0.09);
  --text: #e8ecf5;
  --muted: #9aa5bd;
  --acc1: #8b5cf6;
  --acc2: #22d3ee;
  --good: #34d399;
  --bad: #f87171;
  --grad: linear-gradient(135deg, #8b5cf6, #22d3ee);
}
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1d2a44, var(--bg));
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
code { font-family: 'Cascadia Code', Consolas, monospace; color: var(--acc2); }
a { color: var(--acc2); text-decoration: none; }
.dim { color: var(--muted); }
.small { font-size: 13px; }

/* фоновые сферы */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.16; animation: float 14s ease-in-out infinite; }
.o1 { width: 420px; height: 420px; background: var(--acc1); top: -120px; left: -80px; }
.o2 { width: 380px; height: 380px; background: var(--acc2); top: 30%; right: -120px; animation-delay: -5s; }
.o3 { width: 300px; height: 300px; background: #d946ef; bottom: -100px; left: 35%; animation-delay: -9s; }
@keyframes float { 50% { transform: translateY(40px); } }

/* топбар */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 6vw; position: sticky; top: 0; z-index: 10;
  background: rgba(11, 15, 28, 0.75); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.logo { font-size: 21px; font-weight: 700; letter-spacing: 0.5px; }
.logo-d20 { color: var(--acc2); margin-right: 6px; }
#nav { display: flex; gap: 10px; align-items: center; }
#nav a { color: var(--muted); margin-right: 12px; font-size: 14px; }
#nav a:hover { color: var(--text); }

/* кнопки */
.btn {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  padding: 10px 20px; border-radius: 12px; cursor: pointer; font-size: 15px;
  transition: all 0.18s ease; font-family: inherit;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(139, 92, 246, 0.5); }
.btn.primary { background: var(--grad); border: none; font-weight: 600; color: #fff; }
.btn.primary:hover { box-shadow: 0 8px 28px rgba(139, 92, 246, 0.45); }
.btn.danger { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.3); color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 14px; font-size: 13px; border-radius: 9px; }
.btn.xl { padding: 14px 30px; font-size: 16px; border-radius: 14px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: wait; transform: none; }

/* герой */
.hero { text-align: center; padding: 70px 6vw 30px; }
.hero-badge {
  display: inline-block; padding: 7px 16px; border-radius: 99px; font-size: 13px;
  background: rgba(139, 92, 246, 0.12); border: 1px solid rgba(139, 92, 246, 0.3); margin-bottom: 26px;
}
.hero h1 { font-size: clamp(34px, 5.4vw, 58px); line-height: 1.12; font-weight: 800; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { max-width: 640px; margin: 22px auto 0; color: var(--muted); font-size: 17px; line-height: 1.65; }
.yourname { background: rgba(34, 211, 238, 0.1); padding: 2px 8px; border-radius: 8px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; margin: 34px 0 46px; flex-wrap: wrap; }

/* макет браузера */
.browser {
  max-width: 680px; margin: 0 auto; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--border); background: var(--bg2);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.browser-bar { display: flex; gap: 7px; align-items: center; padding: 11px 16px; background: rgba(0,0,0,0.35); }
.browser-bar i { width: 11px; height: 11px; border-radius: 50%; background: #3a4258; }
.browser-bar span { margin-left: 12px; font-size: 13px; color: var(--muted); font-family: monospace; }
.typewrite { color: var(--acc2); font-weight: 600; }
.browser-body { display: flex; align-items: center; justify-content: center; gap: 30px; padding: 44px 20px; position: relative; }
.fvtt-mock { text-align: center; }
.fvtt-mock .d20 { font-size: 44px; color: #cc3333; text-shadow: 0 0 24px rgba(204, 51, 51, 0.55); }
.fvtt-title { font-weight: 700; margin-top: 12px; letter-spacing: 0.4px; }
.fvtt-sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.players { display: flex; gap: 8px; justify-content: center; margin-top: 18px; }
.players span { width: 30px; height: 30px; border-radius: 50%; background: var(--grad); opacity: 0.85; animation: bob 2.6s ease-in-out infinite; }
.players span:nth-child(2) { animation-delay: 0.3s; background: linear-gradient(135deg, #f59e0b, #ef4444); }
.players span:nth-child(3) { animation-delay: 0.6s; background: linear-gradient(135deg, #34d399, #22d3ee); }
.players span:nth-child(4) { animation-delay: 0.9s; background: linear-gradient(135deg, #d946ef, #8b5cf6); }
@keyframes bob { 50% { transform: translateY(-7px); } }
.lock { position: absolute; right: 22px; top: 14px; font-size: 12px; color: var(--good); background: rgba(52, 211, 153, 0.1); padding: 4px 10px; border-radius: 8px; }

/* секции */
.features, .how, .pricing { max-width: 1100px; margin: 0 auto; padding: 60px 6vw; }
.features h2, .how h2, .pricing h2 { text-align: center; font-size: 30px; margin-bottom: 14px; }
.pricing .sub { text-align: center; color: var(--muted); margin-bottom: 30px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 34px; }
.feature { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 26px; transition: 0.2s; }
.feature:hover { transform: translateY(-3px); border-color: rgba(139, 92, 246, 0.4); }
.feature .ic { font-size: 26px; margin-bottom: 12px; }
.feature h3 { font-size: 17px; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: 14px; line-height: 1.6; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 34px; }
.step { text-align: center; padding: 28px 20px; }
.step .num {
  width: 46px; height: 46px; border-radius: 14px; background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; margin: 0 auto 14px;
}
.step h3 { margin-bottom: 8px; }
.step p { color: var(--muted); font-size: 14px; line-height: 1.6; }

/* тарифы */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; max-width: 860px; margin: 0 auto; }
.plans.mini { max-width: none; margin-top: 14px; }
.plan { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 26px 22px; text-align: center; position: relative; }
.plan.best { border-color: rgba(139, 92, 246, 0.55); box-shadow: 0 0 40px rgba(139, 92, 246, 0.12); }
.plan .tag { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: var(--grad); font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 99px; color: #fff; }
.plan h3 { font-size: 15px; color: var(--muted); font-weight: 600; }
.plan .price { font-size: 34px; font-weight: 800; margin: 10px 0 4px; }
.plan .per { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.plan .save { color: var(--good); font-size: 13px; margin-bottom: 6px; min-height: 18px; }

.footer { text-align: center; padding: 40px 6vw 60px; color: var(--muted); font-size: 14px; line-height: 2; }

/* auth */
#view-auth:not([hidden]) { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 120px); padding: 30px 5vw; }
.auth-card {
  width: 100%; max-width: 430px; background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 36px; backdrop-filter: blur(8px);
}
.auth-tabs { display: flex; background: rgba(0,0,0,0.3); border-radius: 12px; padding: 4px; margin-bottom: 26px; }
.auth-tabs .tab { flex: 1; border: none; background: transparent; color: var(--muted); padding: 10px; border-radius: 9px; cursor: pointer; font-size: 14px; font-family: inherit; }
.auth-tabs .tab.active { background: var(--grad); color: #fff; font-weight: 600; }
.auth-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.auth-form input {
  display: block; width: 100%; margin-top: 7px; padding: 13px 15px; border-radius: 12px;
  border: 1px solid var(--border); background: rgba(0,0,0,0.3); color: var(--text); font-size: 15px; font-family: inherit;
}
.auth-form input:focus { outline: none; border-color: var(--acc1); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2); }
.hint { font-size: 12.5px; margin: -8px 0 16px; color: var(--muted); }
.form-msg { margin-top: 14px; font-size: 14px; min-height: 20px; }
.form-msg.err { color: var(--bad); }
.form-msg.ok { color: var(--good); }

/* дашборд */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; padding: 34px 5vw; max-width: 1240px; margin: 0 auto; align-items: start; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 26px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.card-head h2 { font-size: 19px; }
.sub-badge { font-size: 12.5px; padding: 5px 12px; border-radius: 99px; background: rgba(52, 211, 153, 0.12); color: var(--good); border: 1px solid rgba(52, 211, 153, 0.25); }
.sub-badge.off { background: rgba(248, 113, 113, 0.1); color: var(--bad); border-color: rgba(248, 113, 113, 0.25); }

.domain-box { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.domain {
  font-size: clamp(20px, 3vw, 30px); font-weight: 700; font-family: 'Cascadia Code', Consolas, monospace;
  padding: 16px 22px; border-radius: 14px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border);
  word-break: break-all; flex: 1; min-width: 240px;
}
.domain .proto { color: var(--muted); font-weight: 400; font-size: 0.75em; }
.domain-side { display: flex; align-items: center; gap: 12px; }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #64748b; display: inline-block; }
.status.on .dot { background: var(--good); box-shadow: 0 0 12px var(--good); animation: pulse 2s infinite; }
.status.on { color: var(--good); }
.status.wait .dot { background: #f59e0b; box-shadow: 0 0 12px #f59e0b; }
.status.wait { color: #f59e0b; }
@keyframes pulse { 50% { opacity: 0.55; } }

.tunnel-actions { margin-top: 20px; display: flex; gap: 12px; flex-wrap: wrap; }
.connect-box { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 20px; }
.connect-title { font-size: 14.5px; margin-bottom: 14px; color: var(--muted); }
.tabs.sm { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs.sm .tab { border: 1px solid var(--border); background: transparent; color: var(--muted); padding: 7px 13px; border-radius: 9px; cursor: pointer; font-size: 12.5px; font-family: inherit; }
.tabs.sm .tab.active { background: rgba(139, 92, 246, 0.15); color: var(--text); border-color: rgba(139, 92, 246, 0.5); }
.ctab ol.plain { padding-left: 20px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.plain { list-style: none; padding: 0; }
.code {
  font-family: 'Cascadia Code', Consolas, monospace; font-size: 12.5px; background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border); padding: 10px 13px; border-radius: 10px; margin: 8px 0;
  word-break: break-all; color: var(--acc2); user-select: all;
}
.code.token { color: #fbbf24; }
.status-hint { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.help-card ul.plain li { margin: 10px 0; line-height: 1.55; }
.sub-info-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.sub-info-row b { font-weight: 600; }
.promo-row { display: flex; gap: 8px; margin-top: 18px; }
.promo-row input {
  flex: 1; padding: 10px 13px; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3); color: var(--text); font-family: inherit; font-size: 14px;
}
.promo-row input:focus { outline: none; border-color: var(--acc1); }

/* toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1c2438; border: 1px solid var(--border); color: var(--text);
  padding: 13px 22px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: all 0.25s ease; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
  .topbar { padding: 14px 4vw; }
  #nav a { display: none; }
  .dash-grid { padding: 20px 4vw; }
  .card { padding: 18px; }
}
