*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Courier New", monospace;
  background-color: #080c1a;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  pointer-events: none;
  z-index: 10;
}

.glow-blue {
  position: fixed;
  width: 500px;
  height: 500px;
  background: radial-gradient(
    circle,
    rgba(30, 80, 200, 0.35) 0%,
    transparent 70%
  );
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  pointer-events: none;
}

.glow-purple-left {
  position: fixed;
  width: 400px;
  height: 400px;
  background: radial-gradient(
    circle,
    rgba(120, 30, 180, 0.3) 0%,
    transparent 70%
  );
  bottom: 0;
  left: 0;
  pointer-events: none;
}

.glow-purple-right {
  position: fixed;
  width: 400px;
  height: 400px;
  background: radial-gradient(
    circle,
    rgba(160, 30, 180, 0.25) 0%,
    transparent 70%
  );
  bottom: 0;
  right: 0;
  pointer-events: none;
}

.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.star {
  position: absolute;
  background: rgba(180, 160, 100, 0.7);
  border-radius: 50%;
}

.container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
}

.logo-wrap {
  position: relative;
  width: 250px;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.logo-circle {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px dashed rgba(180, 140, 80, 0.5);
  animation: spin 30s linear infinite;
}

.logo-circle::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1px dashed rgba(180, 140, 80, 0.25);
}

.logo-placeholder {
  width: 250px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-placeholder img {
  width: 100%;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 280px;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: rgba(180, 140, 80, 0.4);
}

.divider-diamond {
  width: 8px;
  height: 8px;
  background: rgba(180, 140, 80, 0.8);
  transform: rotate(45deg);
}

.title {
  color: #eac629;
  font-size: 0.85rem;
  letter-spacing: 0.35em;
  font-weight: normal;
  text-transform: uppercase;
}

/* Steps */
.step {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: min(400px, 90vw);
}

.step.hidden {
  display: none;
}

.phone-row {
  display: flex;
  background: rgba(10, 14, 35, 0.6);
  border: 1px solid #32285e;
  border-radius: 4px;
}

/* DDI country selector */
.ddi-selector {
  position: relative;
  flex-shrink: 0;
}

.ddi-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.9rem 0.8rem;
  height: 100%;
  background: transparent;
  border: none;
  border-right: 1px solid #32285e;
  color: #eac629;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  font-family: "Courier New", monospace;
  cursor: pointer;
  white-space: nowrap;
}

.ddi-btn:hover {
  background: rgba(180, 140, 80, 0.08);
}

.ddi-arrow {
  font-size: 0.55rem;
  opacity: 0.55;
}

.ddi-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #0d1228;
  border: 1px solid #32285e;
  border-radius: 4px;
  min-width: 210px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: #32285e transparent;
}

.ddi-dropdown.hidden {
  display: none;
}

.ddi-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  color: rgba(200, 170, 100, 0.7);
  font-family: "Courier New", monospace;
  transition: background 0.15s;
}

.ddi-option:hover,
.ddi-option.active {
  background: rgba(180, 140, 80, 0.1);
  color: #eac629;
}

.ddi-option-code {
  margin-left: auto;
  opacity: 0.5;
  font-size: 0.7rem;
}

.ddi-search {
  display: block;
  width: 100%;
  padding: 0.55rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: none;
  border-bottom: 1px solid #32285e;
  color: rgba(200, 170, 100, 0.85);
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  font-family: "Courier New", monospace;
  outline: none;
  position: sticky;
  top: 0;
  z-index: 1;
}

.ddi-search::placeholder {
  color: rgba(200, 170, 100, 0.3);
}

.phone-input {
  flex: 1;
  padding: 0.9rem 1rem;
  background: transparent;
  border: none;
  outline: none;
  color: rgba(200, 170, 100, 0.8);
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  font-family: "Courier New", monospace;
}

.phone-input::placeholder {
  color: rgba(200, 170, 100, 0.35);
  letter-spacing: 0.2em;
}

.action-btn {
  width: 100%;
  padding: 1rem 1.8rem;
  background: transparent;
  border: 1px solid #32285e;
  border-radius: 4px;
  color: #eac629;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: "Courier New", monospace;
  transition: background 0.2s;
  margin-top: 6px;
}

.action-btn:hover {
  background: rgba(180, 140, 80, 0.1);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-message {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-align: center;
  min-height: 1.2em;
  padding: 0.2rem 0;
}

.form-message.error {
  color: #e05c5c;
}

.form-message.success {
  color: #6edb8f;
}

/* OTP overlay (bottom sheet) — mirrors book.css exactly */
.otp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.otp-sheet {
  width: 100%;
  max-width: 480px;
  background: #1a1a1a;
  border-radius: 20px 20px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 1rem);
  animation: otp-slide-up 0.25s ease;
}

@keyframes otp-slide-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.otp-sheet-header {
  position: relative;
  padding: 1.4rem 1rem 0.9rem;
}

.otp-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.3rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-family: inherit;
}

.otp-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.35rem;
}

.otp-sub {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.45);
}

.otp-digits-row {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  padding: 1rem 1rem 0.5rem;
}

.otp-digit {
  width: 46px;
  height: 54px;
  background: #141414;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
  font-family: inherit;
  caret-color: #9048d1;
  -moz-appearance: textfield;
  appearance: textfield;
}

.otp-digit::-webkit-inner-spin-button,
.otp-digit::-webkit-outer-spin-button {
  display: none;
}

.otp-digit:focus {
  outline: none;
  border-color: #9048d1;
}

.confirm-btn {
  width: 100%;
  display: block;
  background: #9048d1;
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  padding: 0.95rem;
  cursor: pointer;
  transition:
    opacity 0.15s,
    background 0.15s;
}

.confirm-btn:hover {
  background: #7a38b5;
}
.confirm-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.otp-resend {
  text-align: center;
  padding: 0 1rem 0.5rem;
}

.otp-resend-btn {
  background: none;
  border: none;
  color: #fef450;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 0.5rem;
}

.otp-resend-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.field-error {
  color: #e05c5c;
  font-size: 0.8rem;
  padding: 0 0 0.5rem;
}

/* Topbar */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 2rem;
  padding: 1.2rem 2.5rem;
  border-bottom: 1px solid rgba(180, 140, 80, 0.1);
  background: rgba(8, 12, 26, 0.7);
  backdrop-filter: blur(8px);
}

.topbar a {
  color: #eac629;
  text-decoration: none;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.topbar a.app-link {
  border: 1px solid rgba(180, 140, 80, 0.4);
  padding: 0.45rem 1rem;
  border-radius: 3px;
}

.topbar a.app-link:hover {
  background: rgba(180, 140, 80, 0.1);
}

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  text-align: center;
  padding: 1rem;
  color: rgba(200, 170, 100, 0.35);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  border-top: 1px solid rgba(180, 140, 80, 0.1);
  background: rgba(8, 12, 26, 0.7);
  backdrop-filter: blur(8px);
}

/* Profile form (step 2) */
.profile-title {
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: left;
  margin-bottom: 0.75rem;
  font-family: "Courier New", monospace;
  letter-spacing: 0.02em;
}

.profile-field {
  position: relative;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.profile-input {
  width: 100%;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1rem;
  padding: 0.65rem 0;
  font-family: "Courier New", monospace;
  outline: none;
  letter-spacing: 0.03em;
}

.profile-input::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

.profile-country-field {
  position: relative;
}

.profile-country-btn {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  text-align: left;
  color: rgba(255, 255, 255, 0.28);
  font-size: 1rem;
  padding: 0.65rem 0;
  font-family: "Courier New", monospace;
  cursor: pointer;
  letter-spacing: 0.03em;
}

.profile-country-btn.selected {
  color: #fff;
}

.profile-country-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: #0d1228;
  border: 1px solid #32285e;
  border-radius: 6px;
  max-height: 190px;
  overflow-y: auto;
  z-index: 200;
  scrollbar-width: thin;
  scrollbar-color: #32285e transparent;
}

.profile-country-dropdown.hidden {
  display: none;
}

.profile-country-search {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: none;
  border-bottom: 1px solid #32285e;
  color: rgba(200, 170, 100, 0.85);
  font-size: 0.78rem;
  font-family: "Courier New", monospace;
  outline: none;
  position: sticky;
  top: 0;
  z-index: 1;
}

.profile-country-search::placeholder {
  color: rgba(200, 170, 100, 0.3);
}

.profile-country-option {
  padding: 0.45rem 0.75rem;
  color: rgba(200, 170, 100, 0.7);
  font-size: 0.82rem;
  font-family: "Courier New", monospace;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: background 0.12s;
}

.profile-country-option:hover,
.profile-country-option.active {
  background: rgba(180, 140, 80, 0.1);
  color: #eac629;
}

.profile-birthday-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0;
}

.profile-birthday-label {
  color: rgba(255, 255, 255, 0.28);
  font-size: 1rem;
  font-family: "Courier New", monospace;
  letter-spacing: 0.03em;
}

.profile-birthday-label.has-value {
  color: #fff;
}

.profile-add-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
  font-family: "Courier New", monospace;
  padding: 0.25rem 0.65rem;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: background 0.15s;
}

.profile-add-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.profile-date-input {
  width: 100%;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1rem;
  padding: 0;
  font-family: "Courier New", monospace;
  outline: none;
  letter-spacing: 0.03em;
}

.profile-date-input::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.45);
  cursor: pointer;
}

/* Show dimmed when date is unset */
.profile-date-input:not(:valid) {
  color: rgba(255, 255, 255, 0.3);
}

.profile-username-field {
  display: flex;
  align-items: center;
}

.profile-at {
  color: rgba(255, 255, 255, 0.28);
  font-size: 1rem;
  font-family: "Courier New", monospace;
  padding: 0.65rem 0.15rem 0.65rem 0;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.profile-continue-btn {
  width: 100%;
  padding: 0.95rem;
  background: #9048d1;
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  font-family: "Courier New", monospace;
  cursor: pointer;
  margin-top: 0.5rem;
  transition:
    background 0.15s,
    opacity 0.15s;
  letter-spacing: 0.04em;
}

.profile-continue-btn:hover {
  background: #7a38b5;
}

.profile-continue-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Container in profile mode: allow scroll on small screens */
.container.profile-mode {
  overflow-y: auto;
  max-height: 100vh;
  padding: 5rem 1.5rem 4rem;
  justify-content: flex-start;
}

/* ── Profile form v2 — card-style (mirrors book.css) ─────── */
#step-profile {
  gap: 1rem;
}

.pf-form-card {
  background: #1e1e1e;
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.pf-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.pf-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  font-family: "Courier New", monospace;
}

.pf-required {
  color: #e05050;
}

.pf-name-row {
  display: flex;
  gap: 0.5rem;
}

.pf-card {
  background: #141414;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.75rem;
  position: relative;
  transition: border-color 0.15s;
}

.pf-card:focus-within {
  border-color: rgba(144, 72, 209, 0.6);
}

.pf-half {
  flex: 1;
  min-width: 0;
}

.pf-input {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.85rem;
  font-family: "Courier New", monospace;
  outline: none;
}

.pf-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
  opacity: 1;
}

.pf-select-wrap {
  display: flex;
  align-items: center;
}

.pf-select {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.85rem;
  font-family: "Courier New", monospace;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.pf-select.has-value {
  color: #fff;
}

.pf-select option {
  background: #2a2a2a;
  color: #fff;
}

.pf-arrow {
  color: rgba(255, 255, 255, 0.4);
  pointer-events: none;
  flex-shrink: 0;
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

.pf-country-btn {
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.85rem;
  font-family: "Courier New", monospace;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pf-country-btn.selected {
  color: #fff;
}

.pf-username-card {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.pf-at {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.85rem;
  font-family: "Courier New", monospace;
  flex-shrink: 0;
}

.pf-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
  padding: 1.5rem 0 0.5rem;
}

.pf-success.hidden {
  display: none;
}

.pf-success-title {
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  font-family: "Courier New", monospace;
}

.pf-success-sub {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  font-family: "Courier New", monospace;
  line-height: 1.5;
  max-width: 280px;
}

.pf-get-app-btn {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.95rem;
  background: #9048d1;
  color: #fff;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  font-family: "Courier New", monospace;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s;
}

.pf-get-app-btn:hover {
  background: #7a38b5;
}

.creator-btn {
  display: block;
  width: 100%;
  padding: 1rem;
  background: #3a5af5;
  border-radius: 14px;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  font-family: "Courier New", monospace;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 0.5rem;
  letter-spacing: 0.02em;
}

.creator-btn:hover {
  background: #2a47e0;
}

.back-link {
  display: block;
  text-align: center;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.85rem;
  font-family: "Courier New", monospace;
  text-decoration: none;
  padding: 0.4rem 0;
  transition: color 0.15s;
  letter-spacing: 0.05em;
}

.back-link:hover {
  color: rgba(255, 255, 255, 0.75);
}

/* Mobile */
@media (max-width: 600px) {
  .container {
    gap: 1.5rem;
    padding: 5rem 1.2rem 4rem;
    width: 100%;
  }

  .logo-wrap {
    width: 160px;
    height: 160px;
  }

  .logo-placeholder {
    width: 160px;
    height: 160px;
  }

  .topbar {
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .topbar a {
    font-size: 0.6rem;
    letter-spacing: 0.08em;
  }

  .topbar a.app-link {
    padding: 0.35rem 0.65rem;
  }

  .step {
    width: 100%;
  }
}
