@font-face {
  font-family: "LEGO Typewell";
  src: url("../fonts/LEGOTypewell.woff2") format("woff2"),
       url("../fonts/LEGOTypewell.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "LEGO Typewell", "Helvetica Neue", Arial, sans-serif;
  color: #fff;
  background: url("../images/lego-gradient.jpg") center / cover no-repeat fixed, #1a1a1a;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Locale toggle (top-right, above frame) */
.locale-switch {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 8px);
  right: 12px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 8px;
  border-radius: 12px;
}
.locale-switch button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  letter-spacing: 1px;
  padding: 2px 4px;
  cursor: pointer;
  opacity: 0.55;
}
.locale-switch button.active { opacity: 1; font-weight: 700; }

/* Black frame containing the screens, with gradient peeking around */
.frame {
  position: relative;
  flex: 1;
  max-width: 480px;
  margin: 8px;
  background: #000;
  overflow: hidden;

  border-radius: 25px;
  border: 1px solid #fff;
}

/* Screens are stacked; only .active is visible. Fade + scale transition.
   z-index: 2 keeps the screen content above the tulipes layer (z-index 1). */
.screen {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  padding: 24px 24px 0;
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition:
    opacity 0.5s ease,
    transform 0.6s cubic-bezier(0.34, 1.25, 0.64, 1);
}
.screen.active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

#screen-intro  { overflow: hidden; padding-bottom: 0; }
#screen-form,
#screen-success { padding-bottom: 80px; background: #000; }

/* --- Intro exit animation ----------------------------------------- */
#screen-intro .logos,
#screen-intro .content {
  transition: opacity 0.35s ease, transform 0.35s ease;
}
#screen-intro.is-leaving .logos,
#screen-intro.is-leaving .content {
  opacity: 0;
  transform: scale(0.88);
}
#screen-intro .tulipes {
  transition: transform 0.75s cubic-bezier(0.45, -0.3, 0.4, 1.05);
}
#screen-intro.is-leaving .tulipes {
  transform: translateX(-50%) translateY(115%);
}

/* --- Peek tulipes (form / success) --------------------------------- */
.tulipes-peek {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 110vw;
  transform: translateX(-50%) translateY(100%);
  pointer-events: none;
  z-index: 20;
  transition: transform 0.85s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.tulipes-peek.visible {
  transform: translateX(-50%) translateY(72%);
}

.tulipes-peek img {
  display: block;
  width: 100%;
  height: auto;
}
.screen.no-transition { transition: none !important; }

.logos {
  text-align: center;
  padding: 8px 0 24px;
}
.logos img {
  max-width: 60vw;
  height: auto;
  display: inline-block;
}

.content {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.content-center {
  align-items: center;
  text-align: center;
  justify-content: center;
}

.content > h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.1;
  margin-bottom: 24px;
}
#screen-form .content > h1,
#screen-success .content > h1 {
  text-align: center;
  margin-bottom: 18px;
}
.content > p {
  font-size: 16px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 24px;
}

.checkmark {
  margin-bottom: 18px;
}

/* Tulipes — in-flow block after the button on the intro screen */
.tulipes {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: 110vw;
  flex-shrink: 0;
  pointer-events: none;
}
.tulipes img {
  display: block;
  width: 100%;
  height: auto;
}

/* Primary red CTA button */
.btn-primary {
  display: block;
  width: 100%;
  background: #d8112a;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 14px 16px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  margin-top: auto;
  margin-bottom: 24px;
}
.btn-primary:active { background: #b50e23; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

#screen-intro .btn-primary { margin-top: 8px; }

/* Form */
#entry-form { display: flex; flex-direction: column; gap: 14px; margin-bottom: 150px; }
.field { display: flex; flex-direction: column; }
.field label {
  font-size: 11px;
  letter-spacing: 1px;
  font-weight: 700;
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.95);
}
.field input {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font: inherit;
  font-size: 15px;
  padding: 6px 0;
  outline: none;
  border-radius: 0;
}
.field input:focus { border-bottom-color: #fff; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }
.field input.invalid { border-bottom-color: #ff6b7a; }
.field .error {
  display: block;
  min-height: 14px;
  font-size: 11px;
  color: #ff6b7a;
  margin-top: 4px;
}

.links {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.links a {
  color: #d8112a;
  font-size: 12px;
  text-decoration: underline;
}

.btn-submit { margin-top: 8px; margin-bottom: 12px; }

.rules {
  font-size: 10px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  margin-bottom: 24px;
}

/* Popups */
.popup {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}
.popup.open { display: flex; }
.popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}
.popup-card {
  position: relative;
  z-index: 1;
  width: calc(100% - 32px);
  max-width: 400px;
  background: #fff;
  color: #1a1a1a;
  border-radius: 8px;
  padding: 22px 18px 18px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.popup-card h2 {
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 18px;
}
.popup-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: #555;
  cursor: pointer;
  padding: 4px 8px;
}

/* Steps list inside insiders popup */
.steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.steps li {
  background: #f3f3f3;
  border-radius: 8px;
  padding: 14px 14px 14px 44px;
  position: relative;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-line;
}
.step-num {
  position: absolute;
  top: 10px;
  left: 12px;
  width: 22px; height: 22px;
  background: #d8112a;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 360px) {
  .content > h1 { font-size: 24px; }
  .screen { padding: 18px 18px 0; }
}
