@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

:root {
  --bg: #0d1117;
  --bg-2: #111827;
  --surface: rgba(20, 27, 36, 0.82);
  --surface-strong: #182230;
  --surface-soft: rgba(255, 255, 255, 0.05);
  --text: #f8fafc;
  --muted: #a7b0bd;
  --dim: #697586;
  --line: rgba(255, 255, 255, 0.12);
  --yellow: #f4d35e;
  --cyan: #56cfe1;
  --green: #79e6a3;
  --red: #ff6b6b;
  --ink: #08111f;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "Space Mono", "SFMono-Regular", Consolas, monospace;
  --radius: 8px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 8%, rgba(86, 207, 225, 0.14), transparent 28rem),
    radial-gradient(circle at 84% 18%, rgba(244, 211, 94, 0.12), transparent 24rem),
    linear-gradient(135deg, #0d1117 0%, #121722 54%, #0b1018 100%);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  overflow-x: hidden;
}

body.auth-body,
body.dashboard-body {
  background:
    linear-gradient(rgba(13, 17, 23, 0.88), rgba(13, 17, 23, 0.96)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 90px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 90px),
    var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

#signal-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  opacity: 0.72;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: rgba(13, 17, 23, 0.56);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(18px);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.topbar.scrolled,
.dash-topbar {
  background: rgba(13, 17, 23, 0.86);
  border-bottom-color: var(--line);
}

.brand,
.dash-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--yellow);
  background: rgba(244, 211, 94, 0.08);
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--muted);
}

.topbar-links a,
.dash-logout {
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.topbar-links a:hover,
.dash-logout:hover {
  color: var(--yellow);
}

main {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
}

.hero-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.72fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  padding: 7rem 0 5rem;
}

.hero-copy h1 {
  max-width: 880px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3.2rem, 7vw, 6.8rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0;
  line-height: 0.92;
}

.eyebrow {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--yellow);
}

.hero-text {
  max-width: 650px;
  margin: 2rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.22rem);
}

.hero-actions,
.contact-actions,
.modal-actions,
.form-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-actions {
  margin-top: 2rem;
}

.button,
.btn,
.dash-logout,
.icon-btn,
.contact-actions a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.72rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.button-primary,
.btn-primary {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--ink);
  font-weight: 800;
}

.button-secondary,
.btn-ghost {
  color: var(--muted);
}

.button:hover,
.btn:hover,
.contact-actions a:hover {
  transform: translateY(-1px);
  border-color: rgba(244, 211, 94, 0.55);
}

.machine-panel,
.auth-card,
.dash-stat,
.website-card,
.modal,
.signal-board,
.build-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.machine-panel {
  position: relative;
  min-height: auto;
  padding: 1.5rem;
  overflow: hidden;
}

.machine-panel::before {
  content: "";
  position: absolute;
  inset: 1rem;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  pointer-events: none;
}

.panel-top {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.panel-pill {
  color: var(--green);
}

.fixed-blobys-overlay {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 440px;
  max-width: 100vw;
  z-index: 100;
  pointer-events: none; /* Let clicks pass through empty areas */
}

.fixed-blobys-overlay .blobys-stage {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  pointer-events: none; /* Crucial: the massive SVG box shouldn't block clicks */
  will-change: transform;
}

.bloby, .bloby * {
  transform-box: fill-box;
  transform-origin: center bottom;
  pointer-events: auto; /* Ensure the paths inside catch the click */
  cursor: pointer;
}

.bloby-aura {
  animation: bloby-breathe 5.8s ease-in-out infinite;
}

.bloby-umbra {
  animation: bloby-heavy 7.2s ease-in-out infinite;
}

.bloby-nova {
  animation: bloby-bounce 4.6s ease-in-out infinite;
}

.bloby-flux {
  transform-origin: center center;
  animation: bloby-float 4s ease-in-out infinite;
}

.bloby-face path,
.bloby-shine,
.cable,
.antenna {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bloby-face path {
  stroke: #10131a;
  stroke-width: 5;
}

.bloby-face.tiny path {
  stroke: #fff;
  stroke-width: 4;
}

.bloby-face .brow {
  stroke-width: 7;
}

.bloby-shine {
  stroke: rgba(255, 255, 255, 0.34);
  stroke-width: 8;
}

.cable {
  stroke: rgba(86, 207, 225, 0.28);
  stroke-width: 3;
  stroke-dasharray: 10 12;
  animation: cable-flow 18s linear infinite;
}

.cable-two {
  stroke: rgba(244, 211, 94, 0.26);
  animation-duration: 13s;
}

.antenna {
  stroke: #79e6a3;
  stroke-width: 5;
}

.antenna-dot {
  fill: #79e6a3;
  filter: drop-shadow(0 0 12px rgba(121, 230, 163, 0.9));
}

.bloby-pupil {
  transition: transform 0.16s ease-out;
}

.bloby-label {
  fill: var(--dim);
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@keyframes bloby-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.025, 0.985) translateY(3px); }
}

@keyframes bloby-heavy {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.018, 0.992) translateY(2px); }
}

@keyframes bloby-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  45% { transform: translateY(-8px) rotate(1.5deg); }
  70% { transform: translateY(2px) rotate(-0.8deg); }
}

@keyframes bloby-float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-18px) rotate(4deg); }
}

@keyframes cable-flow {
  to { stroke-dashoffset: -120; }
}

.signal-list {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 0.75rem;
}

.signal-list div,
.model-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.status {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dim);
}

.status.online { background: var(--green); box-shadow: 0 0 14px rgba(121, 230, 163, 0.7); }
.status.warm,
.status.wip { background: var(--yellow); box-shadow: 0 0 14px rgba(244, 211, 94, 0.7); }
.status.idle { background: var(--cyan); }
.status.offline { background: var(--dim); }

.ticker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.ticker span {
  padding: 1rem;
  background: rgba(13, 17, 23, 0.8);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-align: center;
}

.section {
  padding: clamp(4rem, 8vw, 7rem) 0;
}

.section-heading {
  max-width: 720px;
  margin-bottom: 2rem;
}

.section-heading h2,
.contact-section h2,
.auth-title,
.dash-greeting,
.modal-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.25rem, 4vw, 3.6rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1;
}

.build-carousel-wrapper {
  width: 100%;
  overflow: hidden;
  padding: 1rem 0;
  mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}

.build-carousel-track {
  display: flex;
  gap: 1.5rem;
  width: max-content;
  will-change: transform;
}

.build-carousel-track:hover .build-card:not(:hover) {
  opacity: 0.5;
  transform: scale(0.98);
}

.build-card {
  width: 320px;
  flex: 0 0 auto;
  min-height: 340px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease, border-color 0.2s ease;
}

.build-card.featured {
  width: 480px;
  background:
    linear-gradient(140deg, rgba(244, 211, 94, 0.18), rgba(86, 207, 225, 0.08)),
    var(--surface);
}

.build-card:hover {
  transform: translateY(-4px);
  border-color: rgba(244, 211, 94, 0.58);
}

.build-index,
.build-meta {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.72rem;
}

.build-card h3 {
  margin: auto 0 0.75rem;
  font-size: clamp(1.5rem, 3vw, 2.7rem);
  line-height: 1;
}

.build-card p,
.signal-board p,
.about-copy p {
  color: var(--muted);
}

.signal-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.signal-board div {
  padding: 1.5rem;
  background: rgba(13, 17, 23, 0.76);
}

.signal-board strong {
  color: var(--yellow);
  font-family: var(--mono);
}

.contact-section {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: end;
}

.contact-actions {
  justify-content: flex-end;
}

.footer {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.75rem;
  border-top: 1px solid var(--line);
}

/* Auth */
.auth-main {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 2rem;
  align-items: center;
  padding: 6rem clamp(1rem, 4vw, 3rem) 3rem;
}

.auth-intro {
  max-width: 760px;
}

.auth-intro h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(4rem, 10vw, 8.5rem);
  font-style: italic;
  font-weight: 400;
  line-height: 0.82;
}

.auth-intro p {
  max-width: 560px;
  color: var(--muted);
  font-size: 1.1rem;
}

.auth-card {
  padding: 1.5rem;
}

.auth-title {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.auth-subtitle,
.auth-hint,
.form-help {
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.form-input,
.form-select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 0.75rem 0.85rem;
  outline: none;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(244, 211, 94, 0.12);
}

.form-select option {
  background: var(--surface-strong);
}

.input-wrap {
  position: relative;
}

.input-wrap .form-input {
  padding-right: 3rem;
}

.input-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.form-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.5rem 0 1.2rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.checkbox-wrap {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.auth-error {
  min-height: 1.25rem;
  margin-bottom: 1rem;
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.otp-section[hidden],
.setup-fields[hidden],
.login-fields[hidden],
.form-meta[hidden],
.auth-hint[hidden] {
  display: none;
}

.pin-inputs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.45rem;
  margin: 1rem 0;
}

.pin-box {
  width: 100%;
  height: 50px;
  text-align: center;
  font-family: var(--mono);
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.auth-switch {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.auth-switch button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--yellow);
  cursor: pointer;
}

/* Dashboard */
.dash-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem clamp(1rem, 4vw, 3rem);
}

.dashboard {
  padding: 7rem 0 4rem;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: end;
  margin-bottom: 2rem;
}

.dash-greeting {
  font-size: clamp(3rem, 6vw, 5rem);
}

.dash-date {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.dash-stat {
  padding: 1.25rem;
}

.dash-stat-value {
  font-size: 2.4rem;
  font-weight: 800;
}

.dash-stat-label,
.dash-section-title {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.dash-section-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.websites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.website-card {
  padding: 1.2rem;
  min-height: 210px;
  display: flex;
  flex-direction: column;
}

.website-card-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.website-card-actions {
  display: flex;
  gap: 0.4rem;
}

.website-card-name {
  margin: auto 0 0.35rem;
  font-size: 1.45rem;
}

.website-card-url {
  color: var(--yellow);
  font-family: var(--mono);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.website-card-desc {
  color: var(--muted);
}

.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(4, 8, 14, 0.72);
}

.modal-overlay.open {
  display: flex;
}

.modal {
  width: min(460px, 100%);
  padding: 1.5rem;
}

.modal-title {
  font-size: 2.6rem;
  margin-bottom: 1rem;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 1.5rem;
}

@media (max-width: 900px) {
  .hero-shell,
  .auth-main {
    grid-template-columns: 1fr;
  }

  .hero-shell {
    padding-top: 6rem;
  }

  .machine-panel {
    min-height: 460px;
  }

  .ticker,
  .build-grid,
  .signal-board,
  .dash-stats {
    grid-template-columns: 1fr 1fr;
  }

  .build-card.featured {
    grid-column: span 1;
  }

  .contact-section,
  .dash-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }

  .topbar-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }

  .hero-shell {
    padding-top: 8rem;
  }

  .hero-copy h1,
  .auth-intro h1 {
    font-size: clamp(3.25rem, 19vw, 5rem);
  }

  .ticker,
  .build-grid,
  .signal-board,
  .dash-stats,
  .pin-inputs {
    grid-template-columns: 1fr;
  }

  .pin-inputs {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
