/* --- Reset & base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

html {
  overflow-x: hidden;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #ffffff;
  /* zinc-950 */
  color: #0f172a;
  /* zinc-100 */
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Config banner (dev / unconfigured) --- */
.config-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0.6rem 1rem;
  font-size: 0.75rem;
  background-color: #f8fafc;
  /* zinc-900 */
  border-bottom: 1px solid #e2e8f0;
  /* zinc-800 */
  color: #fca5a5;
  /* red-300 for visibility when unconfigured */
  text-align: center;
}

.config-banner code {
  background: #f1f5f9;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.85em;
}

.config-banner[hidden] {
  display: none;
}

/* --- Screen container --- */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(max(2.5rem, env(safe-area-inset-top)) + 1rem) 1.25rem 4rem;
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.center-wrapper {
  flex: 0 0 auto;
  width: 100%;
  max-width: 36rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  min-height: calc(100vh - 6rem);
}

.center-wrapper.intro-visible {
  justify-content: flex-start;
  min-height: 0;
}

/* --- Terminal block (top-left) - Retained for structure but restyled lightly, though script will fade it --- */
.terminal {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  max-width: 90vw;
  margin-bottom: 1rem;
  font-family: 'JetBrains Mono', monospace;
  /* Keeping mono just for the prompt part if any remains */
  font-size: 0.85rem;
}

.terminal-prompt {
  color: #94a3b8;
  /* zinc-500 */
  flex-shrink: 0;
  user-select: none;
}

.terminal-line {
  word-break: break-word;
  line-height: 1.5;
}

.typed-text {
  color: #64748b;
  /* zinc-400 */
  white-space: pre-line;
}

.cursor {
  color: #3b82f6;
  /* blue-500 */
  animation: blink-cursor 1s step-end infinite;
}

@keyframes blink-cursor {
  50% {
    opacity: 0;
  }
}

/* --- Center block: eye + intro text + button --- */
.center-block {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 0 1.5rem;
}

/* Redesigned logo "eye" -> minimal crest/ring turned back into an eye */
.eye-wrap {
  width: 80px;
  height: 80px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.eye {
  width: 56px;
  height: 56px;
  position: relative;
  border: 2px solid #e2e8f0;
  /* zinc-800 */
  border-radius: 75% 0px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  /* subtle continuous breathing effect if wanted, but user just wanted blink */
}

.eye-lid {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  background: #ffffff;
  /* zinc-950, matches bg */
  margin-top: -60px;
  margin-left: -60px;
  transform: rotate(-45deg) translateY(-85px);
  /* hide above */
  transition: transform 0.1s ease-in;
  z-index: 10;
  border-bottom: 2px solid #cbd5e1;
  /* eyelid bottom edge */
}

.eye.blink .eye-lid {
  transform: rotate(-45deg) translateY(0);
  /* cover the eye */
}

.eye-iris {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  /* blue-400 to blue-500 */
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.eye-pupil {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.join-btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #ffffff;
  background-color: #3b82f6;
  /* blue-500 */
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 0.75rem 2.5rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.join-btn.visible {
  opacity: 1;
  transform: translateY(0);
}

.join-btn:hover {
  background-color: #2563eb;
  /* blue-600 */
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.join-btn:active {
  transform: translateY(1px);
}

/* --- Intro text (after eye blinks) --- */
.intro-text {
  width: 100%;
  opacity: 0;
  transform: translateY(1rem);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.intro-text[hidden] {
  display: none;
}

.intro-text.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.intro-text-inner {
  padding: 0 1rem;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 480px) {
  .intro-text-inner {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

.intro-text p,
.intro-text ul {
  margin: 0 0 1.25rem 0;
  font-size: clamp(0.95rem, 2.5vw + 0.8rem, 1.05rem);
  line-height: 1.7;
  color: #64748b;
  /* zinc-400 */
  font-weight: 400;
}

.intro-text p:last-child {
  margin-bottom: 0;
}

.intro-text strong {
  color: #0f172a;
  /* zinc-100 */
  font-weight: 500;
}

.intro-text ul {
  list-style: none;
  padding-left: 0;
  margin-top: 0.5rem;
}

.intro-text ul li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.6rem;
  color: #334155;
  /* zinc-200 */
}

.intro-text ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.5em;
  height: 0.5em;
  background-color: #10b981;
  /* emerald-500 */
  border-radius: 50%;
}

/* --- Form --- */
.form-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 420px;
  padding: 0 1.25rem;
}

.form-card {
  background-color: #f8fafc;
  /* zinc-900 */
  border: 1px solid #e2e8f0;
  /* zinc-800 */
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
}

.form-reassurance {
  font-size: 0.85rem;
  color: #64748b;
  /* zinc-400 */
  margin: 0 0 1.5rem 0;
  line-height: 1.5;
  padding-left: 1.5rem;
  position: relative;
}

.form-reassurance::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.4rem;
  width: 8px;
  height: 8px;
  background-color: #10b981;
  /* emerald-500 */
  border-radius: 50%;
}

.portal-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.portal-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #334155;
  /* zinc-200 */
  font-weight: 500;
}

.portal-form label em {
  font-style: normal;
  color: #94a3b8;
  /* zinc-500 */
  font-weight: 400;
}

.portal-form input {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  background-color: #ffffff;
  /* zinc-950 */
  border: 1px solid #e2e8f0;
  /* zinc-800 */
  color: #0f172a;
  border-radius: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.portal-form input::placeholder {
  color: #94a3b8;
  /* zinc-600 */
}

.portal-form input:hover {
  border-color: #94a3b8;
  /* zinc-700 */
}

.portal-form input:focus {
  outline: none;
  border-color: #3b82f6;
  /* blue-500 */
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.portal-form select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.portal-form select:hover {
  border-color: #94a3b8;
}

.mobile-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.mobile-row select {
  width: 10rem;
  flex-shrink: 0;
}

.mobile-row input {
  flex: 1;
  min-width: 0;
}

.mobile-hint {
  font-size: 0.8rem;
  color: #94a3b8;
  /* zinc-500 */
  margin-top: 0.25rem;
  line-height: 1.4;
}

.mobile-important {
  display: block;
  font-size: 0.8rem;
  color: #3b82f6;
  /* blue-500 */
  margin-top: 0.25rem;
  line-height: 1.4;
}

.portal-form select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.submit-btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: #ffffff;
  background-color: #10b981;
  /* emerald-500 */
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0.85rem 1.5rem;
  cursor: pointer;
  margin-top: 0.5rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.submit-btn:hover {
  background-color: #059669;
  /* emerald-600 */
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

.submit-btn:active {
  transform: translateY(1px);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #059669;
  /* emerald-600 */
  transform: none;
}

.form-error-msg {
  color: #fca5a5;
  /* red-300 */
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  line-height: 1.5;
  padding: 0.75rem 1rem;
  background: rgba(248, 113, 113, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.form-error-msg[hidden] {
  display: none;
}

.form-footer {
  margin: 1.25rem 0 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid #e2e8f0;
  /* zinc-800 */
  text-align: center;
}

.form-footer a {
  color: #94a3b8;
  /* zinc-500 */
  font-size: 0.85rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

.form-footer a:hover {
  color: #0f172a;
  /* zinc-100 */
}

/* --- Confirm message --- */
.confirm-msg {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  max-width: 80vw;
  font-size: 1.1rem;
  font-weight: 500;
  color: #0f172a;
  line-height: 1.6;
}

/* Animations removed in favor of direct state classes. */


/* --- Hide elements used for layout swap --- */
.screen.form-active .terminal,
.screen.form-active .center-wrapper,
.screen.form-active .center-block {
  visibility: hidden;
}

.screen.confirm-active .terminal,
.screen.confirm-active .center-wrapper,
.screen.confirm-active .center-block,
.screen.confirm-active .form-wrap {
  visibility: hidden;
}