* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Poppins', system-ui, sans-serif;
  background: #1B100C;
}

a { color: #F4A98F; text-decoration: none; }
a:hover { color: #ffd0bf; }

.frame { display: block; }

.page {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #1B100C url('bg.jpg') center 20% / cover no-repeat;
}

.overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(17,9,7,.34) 0%, rgba(17,9,7,.52) 38%, rgba(15,8,6,.86) 78%, #0F0806 100%);
}

.content {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 52px 28px 34px;
}

.logo { width: 64px; height: 64px; object-fit: contain; }

.content h1 {
  margin: 14px 0 0;
  font-weight: 800;
  font-size: 32px;
  color: #F5ECE6;
  letter-spacing: -.01em;
  text-shadow: 0 1px 5px rgba(0,0,0,.55);
}

.subtitle {
  margin: 12px 0 0;
  font-size: 16.5px;
  line-height: 1.45;
  color: rgba(245,236,230,.88);
  max-width: 300px;
  text-shadow: 0 1px 5px rgba(0,0,0,.55);
}

/* step1: bez podnaslova, veći logo i naziv, spušteni niže */
body[data-step="step1"] .subtitle { display: none; }
body[data-step="step1"] .content,
body[data-step="step2"] .content { padding-top: 84px; }
body[data-step="step1"] .logo,
body[data-step="step2"] .logo { width: 100px; height: 100px; }
body[data-step="step1"] .content h1,
body[data-step="step2"] .content h1 { font-size: 42px; margin-top: 18px; }

/* step2 (PIN) ne prikazuje gornji podnaslov ispod loga */
body[data-step="step2"] .subtitle { display: none; }

/* ---- steps ---- */
.step { width: 100%; display: flex; flex-direction: column; align-items: center; }
.step.hidden { display: none; }

.step1 { flex-grow: 1; justify-content: center; margin-top: 8px; }
.step2 { flex-grow: 1; justify-content: center; margin-top: 8px; }
.step3 { flex-grow: 1; justify-content: center; }

.title_btn {
  width: 100%;
  text-align: left;
  font-size: 16px;
  font-weight: 700;
  color: #F5ECE6;
  margin: 0 0 10px;
  text-shadow: 0 1px 5px rgba(0,0,0,.55);
}
.title_btn-center { text-align: center; }

.step3 h5 {
  font-size: 18.5px;
  font-weight: 800;
  color: #F5ECE6;
  line-height: 1.38;
  margin: 14px 0 16px;
  text-shadow: 0 1px 5px rgba(0,0,0,.55);
}
.step3 h5 span { color: #F8C3AD; }
.step3 .terms { margin-top: 10px; }

.step form { width: 100%; }

.step input[type="tel"],
.step input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  padding: 17px 18px;
  border-radius: 14px;
  border: 1.5px solid rgba(244,169,143,.4);
  background: rgba(255,255,255,.06);
  color: #F5ECE6;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .02em;
  font-family: 'Poppins', sans-serif;
}
.step input::placeholder { color: rgba(245,236,230,.45); }
.step input:focus { outline: none; border-color: #F4A98F; }

.step2 input[type="text"] {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .5em;
  text-align: center;
}

.btn {
  display: block;
  width: 100%;
  margin-top: 18px;
  text-align: center;
  padding: 17px;
  border-radius: 999px;
  background: linear-gradient(180deg,#F8B9A2,#EE9678);
  color: #2B120C;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .06em;
  box-shadow: 0 10px 24px rgba(238,150,120,.35);
  border: none;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  text-decoration: none;
}

.terms {
  margin-top: 22px;
  font-size: 10.5px;
  line-height: 1.55;
  color: rgba(245,236,230,.62);
  text-align: left;
  text-shadow: 0 1px 5px rgba(0,0,0,.55);
}
.step2 .terms { margin-top: 8px; }

.policy_links {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
}
.policy_links .policy {
  font-size: 12.5px;
  font-weight: 700;
  color: #F8C3AD;
  text-decoration: underline;
}

.badge {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0 0 10px;
}
.badge .badge-circle {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(244,169,143,.14);
  border: 1.5px solid rgba(244,169,143,.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.badge .badge-circle img { width: 46px; height: 46px; object-fit: contain; }
.badge .badge-check {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(180deg,#F8B9A2,#EE9678);
  border: 3px solid #1B100C;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,.35);
}

/* ---- modals ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal.open { display: flex; }
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10,5,4,.72);
}
.modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 82vh;
  background: #1B100C;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  padding: 18px 22px 26px;
  overflow: hidden;
}
.modal-content h2 {
  margin: 0 0 10px;
  padding-right: 30px;
  font-size: 17px;
  font-weight: 700;
  color: #F5ECE6;
  border-bottom: 1px solid rgba(244,169,143,.18);
  padding-bottom: 12px;
}
.modal-body {
  overflow-y: auto;
  color: rgba(245,236,230,.82);
  font-size: 12.5px;
  line-height: 1.55;
  text-align: left;
}
.modal-body h3 { margin: 22px 0 8px; font-size: 15px; color: #F4A98F; }
.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(244,169,143,.4); border-radius: 3px; }

.closeModal {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(244,169,143,.14);
  color: #F4A98F;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

@media (min-width: 481px) {
  .modal { align-items: center; }
  .modal-content { border-radius: 20px; max-height: 80vh; }
}

/* ---- маленькі екрани (старі/вузькі телефони) ---- */
@media (max-width: 359px) {
  .content { padding: 40px 18px 26px; }
  .logo { width: 56px; height: 56px; }
  .content h1 { font-size: 27px; margin-top: 12px; }
  .subtitle { font-size: 14.5px; }
  .title_btn { font-size: 15px; }
  .step input[type="tel"],
  .step input[type="text"] { padding: 15px 16px; font-size: 16.5px; }
  .step2 input[type="text"] { font-size: 23px; letter-spacing: .4em; }
  .btn { padding: 15px; font-size: 15px; }
  .step3 h5 { font-size: 21px; margin: 16px 0 22px; }
  .terms { font-size: 10px; }
}

/* ---- планшет/десктоп: сторінка як картка-телефон по центру екрана ---- */
@media (min-width: 701px) {
  html, body { height: 100%; }
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
    background: radial-gradient(ellipse at 50% 35%, #2a1811 0%, #170e0a 55%, #0b0605 100%);
  }
  /* .frame = рамка-телефон, що обрізає і скролить; .page всередині лишається
     природної висоти (як на мобільному), тому фон/градієнт завжди покривають
     увесь контент, навіть коли він довший за видиму картку. */
  .frame {
    width: 390px;
    max-width: 390px;
    height: min(844px, 92vh);
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 36px;
    background: #1B100C;
    box-shadow:
      0 40px 90px rgba(0,0,0,.55),
      0 0 0 10px #0b0605,
      0 0 0 11px rgba(244,169,143,.18);
  }
  .page {
    width: 100%;
    max-width: none;
    min-height: 100%;
  }
  .content { min-height: min(844px, 92vh); }
}

/* step2: glavni blok na istoj visini kao na step1, link "Uslovi korišćenja" ostaje na dnu */
.step2 { justify-content: flex-start; padding-top: 32px; }
.step2 .policy_links { margin-top: auto; padding-top: 14px; }

/* backend wiring: inline form errors and busy state */
.form-error { color: #ffb4a8; font-size: 14px; margin: 10px 0 0; text-align: center; }
.form-error.hidden { display: none; }
.btn[disabled] { opacity: .6; cursor: wait; }
