:root {
  --ink: #2c1e3f;
  --muted: #817487;
  --line: #eadfe5;
  --violet: #2c1e3f;
  --violet-dark: #1b1028;
  --pink: #ff7ba7;
  --pink-dark: #e95f8e;
  --green: #168361;
  --warm: #fff6f3;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--warm);
  font-family: "Be Vietnam Pro", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

/* The authenticated form stays out of the way until the intro reaches the login state. */
.auth-layout { min-height: 100vh; background: var(--warm); }
.auth-story {
  display: none;
  min-height: 100vh;
  padding: 42px 50px;
  color: #fff;
  background: radial-gradient(circle at 86% 12%, #4b315f 0, transparent 30%), #2c1e3f;
}
.brand, .auth-panel-brand { display: inline-flex; align-items: center; gap: 14px; width: fit-content; }
.brand-mark-image { width: 56px; height: 56px; object-fit: contain; filter: brightness(0) invert(1); }
.brand strong, .auth-panel-brand strong { font-size: 23px; font-weight: 800; letter-spacing: -.04em; }

.auth-panel {
  min-height: 100vh;
  padding: 36px 24px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  opacity: 0;
  transform: translateY(20px) scale(.98);
}
body.login-intro-ready .auth-panel { animation: login-panel-reveal .72s cubic-bezier(.22, 1, .36, 1) both; }
.auth-panel-brand { color: var(--violet); font-size: 18px; }
.auth-panel-brand img { width: 36px; height: 36px; object-fit: contain; }
.auth-card {
  width: min(880px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(31, 26, 70, .1);
}
.auth-entry-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr); gap: 30px; align-items: stretch; }
.auth-entry-grid > #login-panel { padding: 4px 30px 4px 4px; border-right: 1px solid var(--line); }
.card-kicker { margin: 0; color: var(--violet); font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.auth-card h1 { margin: 9px 0 8px; font-size: 28px; line-height: 1.2; letter-spacing: -.04em; }
.signup-panel { display: flex; flex-direction: column; min-height: 100%; padding: 26px; border: 1px solid #f0dce5; border-radius: 16px; background: linear-gradient(145deg, #fff7fa, #fbf7ff); }
.signup-panel h2 { margin: 10px 0 10px; color: var(--ink); font-size: 25px; line-height: 1.2; letter-spacing: -.045em; }
.signup-panel > p:not(.card-kicker) { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.signup-request-form { margin-top: 18px; }
.signup-request-form label { margin-bottom: 11px; }
.signup-request-form textarea { width: 100%; min-height: 65px; padding: 10px 13px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--ink); background: #fbfbfd; font: inherit; font-size: 12px; line-height: 1.45; transition: border .15s, box-shadow .15s; }
.signup-request-form textarea:focus { border-color: #9b90f5; box-shadow: 0 0 0 4px #f0e9f6; }
.optional-label { color: #9b8f9f; font-size: 9px; font-weight: 500; }
.signup-request-form .form-status { min-height: 16px; margin: 2px 0 9px; text-align: left; }
.signup-button { width: 100%; margin-top: auto; color: var(--violet); border-color: #e7d8e4; background: #fff; }
.signup-button:hover { border-color: var(--pink); color: var(--pink-dark); }
.signup-panel small { display: block; margin-top: 12px; color: #9b8f9f; font-size: 10px; line-height: 1.5; }
body.auth-signup-requested .signup-panel { border-color: var(--pink); box-shadow: 0 0 0 4px rgba(255, 123, 167, .10); }
.auth-form-panel { max-width: 430px; margin: 0 auto; }
body.login-activation-flow .auth-entry-grid { display: block; }
body.login-activation-flow #signup-panel { display: none; }
.card-lead { margin: 0 0 27px; color: var(--muted); font-size: 13px; line-height: 1.6; }
form label { display: grid; gap: 7px; margin-bottom: 15px; color: #555363; font-size: 11px; font-weight: 700; }
input { width: 100%; height: 47px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--ink); background: #fbfbfd; font-size: 13px; transition: border .15s, box-shadow .15s; }
input:focus { border-color: #9b90f5; box-shadow: 0 0 0 4px #f0e9f6; }
.button { min-height: 46px; padding: 0 15px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.button.primary { width: 100%; color: #fff; border-color: var(--pink); background: var(--pink); box-shadow: 0 9px 22px rgba(255, 123, 167, .21); }
.button.primary:hover { background: var(--pink-dark); }
.button:disabled { opacity: .55; cursor: wait; }
.button.secondary { color: var(--violet); background: #fff; }
.auth-note { margin: 20px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
.form-message { min-height: 16px; margin: 17px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.form-message[data-tone="error"] { color: #c7474e; }
.form-message[data-tone="success"] { color: var(--green); }
.demo-panel { margin-top: 24px; padding: 16px; border: 1px solid #ddd8ff; border-radius: 12px; color: #4e4598; background: #f0e9f6; }
.demo-panel strong { font-size: 11px; }
.demo-panel p { margin: 6px 0 12px; font-size: 10px; line-height: 1.6; }
.security-note { margin: 0; color: #8c8997; font-size: 10px; }
.security-note span { margin-right: 6px; color: var(--green); }

/* Full-screen Human × AI intro. */
.login-intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
  color: #fff;
  background: #1b1028;
  opacity: 1;
  visibility: visible;
  transition: opacity .68s ease, visibility .68s ease, transform .68s ease, filter .68s ease;
}
.login-intro.is-open {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.03);
  filter: blur(4px);
}
.intro-scene {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(circle at 50% 52%, rgba(255, 123, 167, .12), transparent 15%), radial-gradient(circle at 15% 20%, rgba(122, 79, 160, .25), transparent 32%), radial-gradient(circle at 88% 75%, rgba(89, 53, 127, .26), transparent 35%), #1b1028;
}
.intro-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .25;
  pointer-events: none;
  background: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 92%);
}
.intro-grid { position: absolute; inset: 0; z-index: -2; opacity: .42; background: radial-gradient(ellipse at center, transparent 18%, rgba(255,255,255,.018) 18.5%, transparent 19%), radial-gradient(ellipse at center, transparent 33%, rgba(255,255,255,.014) 33.5%, transparent 34%); background-size: 100% 100%; }
.intro-header { position: absolute; inset: 0 0 auto; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: clamp(24px, 4vw, 48px) clamp(24px, 5vw, 72px); }
.intro-brand { display: inline-flex; align-items: center; gap: 13px; color: #fff; font-size: 22px; font-weight: 800; letter-spacing: -.04em; }
.intro-brand img { width: 40px; height: 40px; object-fit: contain; filter: brightness(0) invert(1); }
.intro-skip { padding: 8px 11px; color: rgba(255,255,255,.66); border: 0; border-radius: 8px; background: transparent; font-size: 11px; cursor: pointer; transition: color .2s ease, background .2s ease; }
.intro-skip:hover, .intro-skip:focus-visible { color: #fff; background: rgba(255,255,255,.08); outline: none; }
.intro-copy { position: absolute; top: clamp(120px, 18vh, 180px); left: clamp(24px, 9vw, 160px); z-index: 2; max-width: 680px; }
.intro-kicker { display: flex; align-items: center; gap: 9px; margin: 0; color: #c0b3ff; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.intro-kicker span { width: 8px; height: 8px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 0 5px rgba(255,123,167,.14); }
.intro-copy h1 { margin: 18px 0 13px; color: #fff; font-size: clamp(42px, 6vw, 82px); line-height: 1.02; letter-spacing: -.065em; }
.intro-copy h1 em { color: var(--pink); font-style: normal; }
.intro-copy > p:last-child { margin: 0; color: rgba(255,255,255,.62); font-size: 15px; }
.intro-orbit { position: absolute; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; pointer-events: none; }
.intro-orbit-one { top: 25%; left: 50%; width: min(520px, 42vw); aspect-ratio: 1; transform: translate(-50%, -50%); box-shadow: 0 0 0 32px rgba(255,255,255,.018), 0 0 0 64px rgba(255,255,255,.012); }
.intro-orbit-two { top: 52%; left: 50%; width: min(860px, 72vw); aspect-ratio: 1; transform: translate(-50%, -50%); opacity: .65; }

.interaction-stage { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.stage-haze { position: absolute; top: 65%; left: 50%; width: min(340px, 28vw); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; opacity: .18; background: radial-gradient(circle, rgba(255,123,167,.65), rgba(162,112,221,.14) 40%, transparent 70%); filter: blur(22px); }
.hand { position: absolute; top: 65%; width: clamp(620px, 72vw, 1120px); transform-origin: 50% 50%; transition: transform .92s cubic-bezier(.22, 1, .36, 1); will-change: transform; }
.hand img { display: block; width: 100%; height: auto; user-select: none; }
.human-hand { left: 50%; transform: translate(calc(-75.7% - var(--hand-gap)), -50%) translate(calc(var(--parallax-x, 0px)), calc(var(--parallax-y, 0px))); }
.robot-hand { left: 50%; transform: translate(calc(-41.3% + var(--hand-gap)), -50%) translate(calc(var(--parallax-x, 0px) * -1), calc(var(--parallax-y, 0px) * -1)); }
.login-intro { --hand-gap: clamp(160px, 18vw, 360px); }
.login-intro.is-connecting .human-hand { transform: translate(-75.7%, -50%); }
.login-intro.is-connecting .robot-hand { transform: translate(-41.3%, -50%); }
.login-intro.is-connecting .stage-haze { opacity: .28; transition: opacity .9s ease; }
.contact-point { position: absolute; top: 65%; left: 50%; width: 9px; height: 9px; transform: translate(-50%, -50%); opacity: .72; }
.contact-core { position: absolute; inset: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 12px 4px rgba(255,255,255,.88), 0 0 26px 10px rgba(255,123,167,.46); }
.contact-ring { position: absolute; inset: 50%; width: 10px; height: 10px; border: 1px solid rgba(255,123,167,.7); border-radius: 50%; transform: translate(-50%, -50%) scale(.5); opacity: 0; }
.login-intro.is-connected .contact-point { opacity: 1; }
.login-intro.is-connected .contact-ring-one { animation: contact-pulse .46s cubic-bezier(.22, 1, .36, 1) both; }
.login-intro.is-connected .contact-ring-two { animation: contact-pulse .62s .08s cubic-bezier(.22, 1, .36, 1) both; }
.contact-particles { position: absolute; top: 65%; left: 50%; width: 1px; height: 1px; }
.contact-particles i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px var(--pink); opacity: 0; }
.login-intro.is-connected .contact-particles i { animation: particle-burst .48s ease-out both; }
.contact-particles i:nth-child(1) { --dx: -38px; --dy: -24px; animation-delay: .02s !important; }
.contact-particles i:nth-child(2) { --dx: 34px; --dy: -31px; animation-delay: .04s !important; }
.contact-particles i:nth-child(3) { --dx: 48px; --dy: 18px; animation-delay: .06s !important; }
.contact-particles i:nth-child(4) { --dx: -48px; --dy: 17px; animation-delay: .08s !important; }
.contact-particles i:nth-child(5) { --dx: 10px; --dy: 44px; animation-delay: .1s !important; }
.contact-particles i:nth-child(6) { --dx: -12px; --dy: -42px; animation-delay: .12s !important; }
.connection-status { position: absolute; top: calc(65% + 42px); left: 50%; margin: 0; color: #ffd8e5; font-size: 9px; font-weight: 800; letter-spacing: .26em; opacity: 0; transform: translateX(-50%) translateY(5px); }
.login-intro.is-connected .connection-status { animation: status-flash .42s ease both; }

.intro-controls { position: absolute; bottom: clamp(38px, 8vh, 86px); left: 50%; z-index: 5; display: grid; justify-items: center; gap: 10px; transform: translateX(-50%); }
.intro-start { display: inline-flex; align-items: center; justify-content: space-between; gap: 34px; min-width: 174px; padding: 13px 14px 13px 20px; color: var(--violet); border: 0; border-radius: 11px; background: #fff; box-shadow: 0 14px 32px rgba(0,0,0,.22); font-size: 12px; font-weight: 800; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease; }
.intro-start b { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: #fff; background: var(--pink); font-size: 18px; line-height: 1; }
.intro-start:hover, .intro-start:focus-visible { box-shadow: 0 18px 38px rgba(0,0,0,.3); transform: translateY(-2px); outline: none; }
.intro-start:disabled { cursor: wait; opacity: .62; transform: none; }
.intro-controls p { margin: 0; color: rgba(255,255,255,.46); font-size: 10px; }

@keyframes login-panel-reveal { from { opacity: 0; transform: translateY(20px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes contact-pulse { 0% { opacity: .8; transform: translate(-50%, -50%) scale(.5); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(15); } }
@keyframes particle-burst { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); } 22% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0); } }
@keyframes status-flash { 0% { opacity: 0; transform: translateX(-50%) translateY(5px); } 30% { opacity: 1; transform: translateX(-50%) translateY(0); } 100% { opacity: 0; transform: translateX(-50%) translateY(0); } }

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

@media (max-width: 860px) {
  .intro-copy { top: 17vh; left: 7vw; max-width: 600px; }
  .intro-copy h1 { font-size: clamp(40px, 8vw, 64px); }
  .hand { width: clamp(560px, 92vw, 800px); }
  .login-intro { --hand-gap: clamp(80px, 14vw, 140px); }
  .intro-controls { bottom: 8vh; }
  .auth-entry-grid { grid-template-columns: 1fr; gap: 24px; }
  .auth-entry-grid > #login-panel { padding: 0 0 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .signup-panel { min-height: 250px; }
}

@media (max-width: 520px) {
  .intro-header { padding: 22px 20px; }
  .intro-brand { gap: 9px; font-size: 18px; }
  .intro-brand img { width: 32px; height: 32px; }
  .intro-skip { padding: 7px 8px; font-size: 10px; }
  .intro-copy { top: 13vh; left: 20px; right: 20px; }
  .intro-kicker { font-size: 9px; letter-spacing: .1em; }
  .intro-copy h1 { margin: 13px 0 9px; font-size: 37px; }
  .intro-copy > p:last-child { font-size: 12px; }
  .interaction-stage { top: 38px; }
  .hand { top: 47%; width: 640px; }
  .login-intro { --hand-gap: clamp(52px, 13vw, 78px); }
  .contact-point, .contact-particles { top: 47%; }
  .connection-status { top: calc(47% + 34px); }
  .intro-controls { bottom: 7vh; }
  .intro-start { min-width: 164px; }
  .auth-panel { padding: 28px 18px; }
  .auth-card { padding: 30px 24px; }
  .signup-panel { min-height: 220px; padding: 22px; }
}
