:root {
  --bg-deep: #02040c;
  --bg-panel: rgba(6, 12, 24, 0.72);
  --border-dim: rgba(0, 255, 170, 0.18);
  --border-glow: rgba(0, 255, 170, 0.55);
  --text-primary: #e8fff4;
  --text-dim: rgba(160, 220, 195, 0.45);
  --accent: #00ffaa;
  --accent-soft: rgba(0, 255, 170, 0.12);
  --danger: #ff4d6a;
  --mono: "Share Tech Mono", "Cascadia Mono", "Consolas", monospace;
  --sans: "Inter", "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.portal-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 16px;
}

#matrix-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.14) 2px,
    rgba(0, 0, 0, 0.14) 4px
  );
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.75) 100%);
}

.portal-shell {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 480px;
  animation: portal-in 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes portal-in {
  from { opacity: 0; transform: translateY(28px) scale(0.97); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

.portal-brand {
  text-align: center;
  margin-bottom: 36px;
}

.brand-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.38em;
  color: var(--text-dim);
  margin-bottom: 14px;
  text-transform: uppercase;
}

.brand-title {
  font-family: var(--mono);
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1.35;
  position: relative;
  display: inline-block;
}

.brand-title .glitch {
  position: relative;
  color: var(--text-primary);
  text-shadow: 0 0 24px rgba(0, 255, 170, 0.35);
}

.brand-title .glitch::before,
.brand-title .glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  overflow: hidden;
  clip-path: inset(0 0 0 0);
}

.brand-title .glitch::before {
  left: 1px;
  text-shadow: -2px 0 #ff00c8;
  animation: glitch-1 3.2s infinite linear alternate-reverse;
}

.brand-title .glitch::after {
  left: -1px;
  text-shadow: 2px 0 var(--accent);
  animation: glitch-2 2.4s infinite linear alternate-reverse;
}

@keyframes glitch-1 {
  0%, 92%, 100% { clip-path: inset(40% 0 50% 0); transform: translate(0); }
  93% { clip-path: inset(10% 0 80% 0); transform: translate(-2px, 1px); }
  95% { clip-path: inset(70% 0 5% 0); transform: translate(2px, -1px); }
}

@keyframes glitch-2 {
  0%, 90%, 100% { clip-path: inset(60% 0 20% 0); transform: translate(0); }
  91% { clip-path: inset(5% 0 70% 0); transform: translate(2px, 1px); }
  94% { clip-path: inset(30% 0 40% 0); transform: translate(-1px, -2px); }
}

.brand-sub {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.portal-card {
  position: relative;
  padding: 2px;
  border-radius: 2px;
  background: linear-gradient(
    135deg,
    rgba(0, 255, 170, 0.35),
    rgba(0, 255, 170, 0.05) 40%,
    rgba(100, 80, 255, 0.15) 70%,
    rgba(0, 255, 170, 0.25)
  );
  box-shadow:
    0 0 60px rgba(0, 255, 170, 0.08),
    0 24px 80px rgba(0, 0, 0, 0.55);
}

.portal-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 3px;
  padding: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.4;
  animation: border-sweep 4s linear infinite;
}

@keyframes border-sweep {
  0% { filter: hue-rotate(0deg); opacity: 0.25; }
  50% { opacity: 0.55; }
  100% { filter: hue-rotate(20deg); opacity: 0.25; }
}

.portal-card-inner {
  position: relative;
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 36px 32px 32px;
  border: 1px solid var(--border-dim);
}

.corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--accent);
  border-style: solid;
  opacity: 0.65;
}

.corner-tl { top: 10px; left: 10px; border-width: 1px 0 0 1px; }
.corner-tr { top: 10px; right: 10px; border-width: 1px 1px 0 0; }
.corner-bl { bottom: 10px; left: 10px; border-width: 0 0 1px 1px; }
.corner-br { bottom: 10px; right: 10px; border-width: 0 1px 1px 0; }

.portal-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.phone-field {
  position: relative;
}

.phone-field input {
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-dim);
  border-radius: 2px;
  padding: 18px 52px 18px 18px;
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

.phone-field input::placeholder {
  color: rgba(160, 220, 195, 0.38);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.phone-field input:focus {
  border-color: var(--border-glow);
  box-shadow:
    0 0 0 1px rgba(0, 255, 170, 0.2),
    0 0 32px rgba(0, 255, 170, 0.12),
    inset 0 0 24px rgba(0, 255, 170, 0.04);
  background: rgba(0, 12, 8, 0.55);
}

.phone-field .caret-line {
  position: absolute;
  bottom: 0;
  left: 18px;
  right: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform: scaleX(0);
  transition: transform 0.35s ease;
}

.phone-field input:focus ~ .caret-line {
  transform: scaleX(1);
}

.portal-submit {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 2px;
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.portal-submit:hover:not(:disabled) {
  background: rgba(0, 255, 170, 0.22);
  box-shadow: 0 0 20px rgba(0, 255, 170, 0.25);
}

.portal-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.portal-submit.loading svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.portal-error {
  margin-top: 14px;
  font-size: 13px;
  color: var(--danger);
  font-family: var(--mono);
  letter-spacing: 0.04em;
  min-height: 20px;
  text-align: center;
  opacity: 0.9;
}

.portal-footer {
  margin-top: 28px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
}

.blink-cursor::after {
  content: "▋";
  animation: blink 1s step-end infinite;
  color: var(--accent);
  margin-left: 2px;
}

@keyframes blink {
  50% { opacity: 0; }
}

.status-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 22px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  box-shadow: 0 0 8px var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (max-width: 480px) {
  .portal-card-inner { padding: 28px 20px 24px; }
  .phone-field input { font-size: 16px; padding-right: 48px; }
}
