*,*::before,*::after { box-sizing: border-box; }
:root {
  --bg: #070b0c;
  --bg2: #0a0e0f;
  --card: rgba(18, 26, 28, 0.55);
  --card-border: rgba(37, 211, 102, 0.18);
  --green: #25d366;
  --green-2: #128c7e;
  --teal: #34d1b7;
  --text: #eaf3f2;
  --muted: #8aa1a1;
  --err: #ff6b6b;
  --glow: 0 0 0 1px rgba(37,211,102,0.25), 0 12px 40px rgba(37,211,102,0.15);
}

html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Backgrounds ─── */
.bg-mesh {
  position: fixed; inset: -20%;
  background:
    radial-gradient(40% 40% at 20% 20%, rgba(37,211,102,0.14), transparent 60%),
    radial-gradient(35% 35% at 80% 30%, rgba(52,209,183,0.12), transparent 60%),
    radial-gradient(45% 45% at 50% 90%, rgba(18,140,126,0.18), transparent 65%);
  filter: blur(60px);
  animation: drift 24s ease-in-out infinite alternate;
  z-index: -2;
  pointer-events: none;
}
@keyframes drift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(-4%, 3%, 0) scale(1.08); }
}
.bg-noise {
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.035 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  z-index: -1;
  opacity: 0.6;
  pointer-events: none;
}

/* ─── Header ─── */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  max-width: 640px; width: 100%; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green), 0 0 4px var(--green);
  animation: pulseDot 2.4s ease-in-out infinite;
}
@keyframes pulseDot {
  0%,100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.85); opacity: 0.65; }
}
.brand-name { font-weight: 800; letter-spacing: 0.02em; font-size: 15px; }
.brand-x { color: var(--green); }
.health-pill {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}
.health-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #666;
  box-shadow: 0 0 8px currentColor;
}
.health-pill.online .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.health-pill.offline .dot { background: var(--err); box-shadow: 0 0 8px var(--err); }

/* ─── Wrap ─── */
.wrap {
  width: 100%; max-width: 640px; margin: 0 auto;
  padding: 8px 22px 60px;
  flex: 1;
}

/* ─── Hero ─── */
.hero { text-align: center; margin: 12px 0 26px; }
.hero h1 {
  font-size: clamp(28px, 6.4vw, 40px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.hero .grad {
  background: linear-gradient(92deg, var(--green), var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .sub { color: var(--muted); font-size: 15px; margin: 0; line-height: 1.5; }

/* ─── Gate ─── */
.gate {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 18px 18px 14px;
  margin: 0 0 18px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.gate-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.gate-sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.channels {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-bottom: 14px;
}
.channel {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  background: rgba(37,211,102,0.06);
  border: 1px solid rgba(37,211,102,0.15);
  transition: all 0.18s ease;
}
.channel:hover {
  background: rgba(37,211,102,0.12);
  border-color: rgba(37,211,102,0.35);
  transform: translateY(-1px);
}
.ch-num {
  width: 22px; height: 22px; border-radius: 6px;
  background: rgba(37,211,102,0.18);
  color: var(--green);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.checkbox {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; color: var(--text); cursor: pointer;
  user-select: none;
  padding: 6px 0;
}
.checkbox input { position: absolute; opacity: 0; pointer-events: none; }
.checkmark {
  width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid rgba(37,211,102,0.5);
  background: rgba(37,211,102,0.05);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
  position: relative;
}
.checkbox input:checked + .checkmark {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(37,211,102,0.5);
}
.checkbox input:checked + .checkmark::after {
  content: '';
  width: 10px; height: 6px;
  border-left: 2px solid #052; border-bottom: 2px solid #052;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* ─── Card ─── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 22px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), var(--glow);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.card.disabled { opacity: 0.55; pointer-events: none; }
.label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin-bottom: 8px;
}
.input-row {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(37,211,102,0.25);
  border-radius: 14px;
  padding: 12px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input-row:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(37,211,102,0.12), 0 0 20px rgba(37,211,102,0.15);
}
.prefix {
  color: var(--green); font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
}
#numberInput {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  letter-spacing: 0.06em;
  caret-color: var(--green);
  min-width: 0;
}
#numberInput::placeholder { color: rgba(138,161,161,0.5); letter-spacing: 0.04em; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 2px 14px; }

.turnstile-wrap { margin-bottom: 14px; }

.btn {
  width: 100%;
  border: none; border-radius: 14px;
  padding: 14px 18px;
  font-size: 15px; font-weight: 700;
  font-family: inherit;
  color: #042b12;
  background: linear-gradient(92deg, var(--green), var(--teal));
  cursor: pointer;
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
  box-shadow: 0 8px 24px rgba(37,211,102,0.28);
  overflow: hidden;
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 12px 32px rgba(37,211,102,0.38);
}
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { cursor: not-allowed; filter: grayscale(0.6) brightness(0.7); box-shadow: none; }
.btn.loading .btn-label { opacity: 0; }
.btn.loading .btn-spinner { display: block; }
.btn-spinner {
  display: none;
  position: absolute; top: 50%; left: 50%;
  width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border: 2.5px solid rgba(4,43,18,0.25);
  border-top-color: #042b12;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.ghost {
  background: transparent;
  border: 1px solid rgba(37,211,102,0.35);
  color: var(--green);
  box-shadow: none;
  margin-top: 18px;
}
.btn.ghost:hover { background: rgba(37,211,102,0.08); filter: none; }

.error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,107,107,0.1);
  border: 1px solid rgba(255,107,107,0.35);
  color: #ffb3b3;
  font-size: 13.5px;
  line-height: 1.4;
}

/* ─── Result ─── */
.result {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 24px 22px 22px;
  margin-top: 18px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), var(--glow);
  animation: slideUp 0.35s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.result-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); margin-bottom: 12px; text-align: center;
}
.code-row {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.code-block {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(26px, 8vw, 40px);
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 14px 18px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(37,211,102,0.12), rgba(37,211,102,0.04));
  border: 1px solid rgba(37,211,102,0.4);
  color: #d9ffe9;
  text-shadow: 0 0 20px rgba(37,211,102,0.5);
  box-shadow: 0 0 30px rgba(37,211,102,0.15), inset 0 0 20px rgba(37,211,102,0.05);
  animation: codeGlow 2.4s ease-in-out infinite alternate;
}
@keyframes codeGlow {
  from { box-shadow: 0 0 24px rgba(37,211,102,0.12), inset 0 0 16px rgba(37,211,102,0.04); }
  to   { box-shadow: 0 0 40px rgba(37,211,102,0.28), inset 0 0 24px rgba(37,211,102,0.08); }
}
.copy-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(37,211,102,0.35);
  background: rgba(37,211,102,0.06);
  color: var(--green);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.copy-btn:hover { background: rgba(37,211,102,0.15); transform: translateY(-1px); }
.copy-btn.copied { background: var(--green); color: #042b12; }

.status-pill {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(37,211,102,0.06);
  border: 1px solid rgba(37,211,102,0.2);
  font-size: 13.5px;
  color: var(--text);
  margin-bottom: 20px;
}
.status-pill .pulse {
  width: 9px; height: 9px; border-radius: 50%;
  background: #f5a623;
  box-shadow: 0 0 10px #f5a623;
  animation: pulseDot 1.4s ease-in-out infinite;
}
.status-pill.connected {
  background: rgba(37,211,102,0.12);
  border-color: rgba(37,211,102,0.5);
  color: #d9ffe9;
}
.status-pill.connected .pulse {
  background: var(--green); box-shadow: 0 0 12px var(--green);
  animation: none;
}

.steps {
  display: grid; gap: 8px;
  margin-bottom: 16px;
}
.step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  font-size: 13.5px;
  color: #c9d8d7;
}
.step span {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(37,211,102,0.15);
  color: var(--green);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.step b { color: var(--text); font-weight: 600; }

.expires {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}
.expires b { color: var(--green); }

/* ─── Footer ─── */
.foot {
  width: 100%; max-width: 640px; margin: 0 auto;
  padding: 20px 22px 30px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  display: flex; flex-direction: column; gap: 6px;
  border-top: 1px solid rgba(255,255,255,0.04);
  margin-top: 20px;
}
.foot b { color: var(--text); }
.foot a { color: var(--green); text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* ─── Success ripple ─── */
.result.success::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 22px;
  background: radial-gradient(circle at 50% 0%, rgba(37,211,102,0.4), transparent 60%);
  animation: ripple 1s ease-out;
  pointer-events: none;
}
@keyframes ripple {
  from { opacity: 1; transform: scale(0.9); }
  to   { opacity: 0; transform: scale(1.4); }
}

/* ─── Small screens ─── */
@media (max-width: 480px) {
  .channels { grid-template-columns: 1fr; }
  .card, .result { padding: 18px; border-radius: 16px; }
  .code-block { padding: 12px 14px; }
  .top { padding: 14px 16px; }
  .wrap { padding: 4px 16px 40px; }
}
