/* WinChat referral sign-up page — "High Roller" design.
   Mobile first: base styles are the phone layout, then tablet (600–899px) and desktop (900px+).
   Colors, radii and type sizes follow the WinChat app theme (winChatDark palette). */

:root {
  --bg: #161616;
  --primary: #ef4d4d;
  --gold: #ffd092;
  --text: #ffffff;
  --text-2: #aeaeae;
  --faint: #a6a6a6;
  --tile: #252525;
  --hair: rgba(255, 255, 255, .07);
  --on-field: #161616;
  --on-id: #5f4d21;
  --success: #4ade80;
  --error: #ff6b6b;
  --id-stops: linear-gradient(90deg, #fee597, #dbb65d 35%, #fff7ce 65%, #d0a649);
  --red-stops: linear-gradient(90deg, #dd3737, #fa5e5e);

  --r-field: 6px;
  --r-tile: 12px;
  --r-card: 16px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box }
html { -webkit-text-size-adjust: 100% }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
}
img { max-width: 100% }
a { color: inherit }
button { font: inherit }
[hidden] { display: none !important }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px }

/* ---------- page shell ---------- */
.page {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.page::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 420px;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(22, 22, 22, .2), var(--bg) 92%),
    url("../assets/bg_login.webp") top center / cover no-repeat;
}

/* ---------- top bar ---------- */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; text-decoration: none }
.brand img { display: block; width: 32px; height: 32px; border-radius: 9px }

.lang { position: relative }
.lang summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(0, 0, 0, .45);
  border: 1px solid var(--hair);
  font-size: 12px;
  font-weight: 600;
}
.lang summary::-webkit-details-marker { display: none }
.lang summary::after { content: "▾"; font-size: 10px; opacity: .8 }
.lang ul {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 5;
  min-width: 140px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: var(--r-tile);
  background: var(--tile);
  border: 1px solid var(--hair);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
}
.lang li a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; font-size: 13px }
.lang li a:hover, .lang li a[aria-current="true"] { background: rgba(255, 255, 255, .06); color: var(--gold) }

/* ---------- intro ---------- */
.intro {
  padding: 150px 20px 0;
  display: grid;
  gap: 10px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .85);
}
.intro h1 { margin: 0; font-size: 28px; line-height: 1.12; font-weight: 800; letter-spacing: -.01em; text-wrap: balance }
.intro h1 em {
  font-style: normal;
  text-shadow: none;
  background: var(--id-stops);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.intro p { margin: 0; color: var(--text-2); max-width: 40ch }
.flow { display: none }

/* ---------- form card ---------- */
.card {
  margin: 20px 12px 0;
  padding: 20px 16px;
  border-radius: var(--r-card);
  background: rgba(22, 22, 22, .92);
  border: 1px solid var(--hair);
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, .9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: grid;
  gap: 16px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--gold); text-transform: uppercase; letter-spacing: .04em }
.idpill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 4px;
  background: var(--id-stops);
  color: var(--on-id);
  font-size: 12px;
  font-weight: 700;
}
.idpill strong { font-size: 13px; letter-spacing: .02em }

.form { display: grid; gap: 16px }
.field { display: grid; gap: 8px }
.field > label { font-size: 14px; font-weight: 600; color: var(--gold) }
.input {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 48px;
  padding: 0 5px 0 14px;
  border-radius: var(--r-tile);
  background: #fff;
  color: var(--on-field);
  border: 1px solid transparent;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(239, 77, 77, .25) }
.field.invalid .input { border-color: var(--error) }
.input input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: none;
  color: inherit;
  font: 500 16px var(--font); /* 16px stops iOS Safari zooming on focus */
}
.input input::placeholder { color: var(--faint); font-size: 14px }
.btn-side {
  flex: none;
  height: 38px;
  min-width: 72px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-field);
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.btn-side:disabled { opacity: .55; cursor: default }
.btn-eye {
  flex: none;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--faint);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.btn-eye svg { width: 20px; height: 20px }
.btn-eye[aria-pressed="true"] { color: var(--on-field) }

.rules { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 11.5px }
.rules li { padding: 3px 8px; border-radius: 99px; background: var(--tile); color: var(--text-2); transition: .15s }
.rules li.ok { background: rgba(34, 197, 94, .16); color: var(--success) }
.rules li.ok::before { content: "✓ " }
.err { margin: 0; font-size: 12px; color: var(--error) }
.err:empty { display: none }

.alert {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--r-tile);
  background: rgba(239, 77, 77, .12);
  border: 1px solid rgba(239, 77, 77, .4);
  color: #ffd6d6;
  font-size: 13px;
}
.alert:empty { display: none }

.btn {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: var(--r-field);
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, box-shadow .15s;
}
.btn:disabled { opacity: .45; cursor: not-allowed }
.btn:not(:disabled):hover { box-shadow: 0 8px 22px -8px rgba(239, 77, 77, .7) }

/* ---------- get the app ---------- */
.gets { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
.get {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border-radius: var(--r-tile);
  background: var(--tile);
  border: 1px solid var(--hair);
  text-decoration: none;
}
.get .gi { flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--red-stops) }
.get .gi svg { width: 18px; height: 18px }
.get span:last-child { display: grid; min-width: 0 }
.get small { color: var(--text-2); font-size: 11px }
.get strong { font-size: 14px; font-weight: 600; line-height: 1.25 }

/* ---------- footer ---------- */
.after { padding: 20px 12px 16px; display: grid; gap: 16px }
.support { display: flex; justify-content: center }
.support a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 13px; font-weight: 500 }
.support .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--tile) }
.support .ic svg { width: 14px; height: 14px }
.legal { margin: 0; text-align: center; color: var(--faint); font-size: 12px }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 12px 14px;
  border-radius: var(--r-tile);
  background: #111;
  border: 1px solid var(--hair);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: .25s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1 }
.toast.error { border-color: rgba(239, 77, 77, .6) }

/* ---------- tablet ---------- */
@media (min-width: 600px) and (max-width: 899px) {
  .page::before {
    height: 480px;
    background:
      linear-gradient(180deg, rgba(22, 22, 22, .35), rgba(22, 22, 22, .75) 55%, var(--bg) 92%),
      url("../assets/bg_login.webp") top center / cover no-repeat;
  }
  .top { padding-inline: 24px }
  .intro { padding: 180px 48px 0; text-align: center; justify-items: center }
  .intro h1 { font-size: 36px }
  .card { margin-inline: auto; width: min(100% - 48px, 480px) }
}

/* ---------- desktop ---------- */
@media (min-width: 900px) {
  .page {
    grid-template-columns: minmax(0, 1fr) 420px;
    grid-template-rows: auto 1fr auto;
    column-gap: 56px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 56px;
  }
  .page::before {
    position: fixed;
    height: 100%;
    background:
      linear-gradient(90deg, rgba(22, 22, 22, .95) 0%, rgba(22, 22, 22, .55) 45%, rgba(22, 22, 22, .9) 100%),
      linear-gradient(180deg, transparent 70%, var(--bg)),
      url("../assets/bg_login.webp") center 30% / cover no-repeat;
  }
  .top { grid-column: 1 / -1; padding: 24px 0 }
  .intro { padding: 0; align-content: center; gap: 16px }
  .intro h1 { font-size: 52px }
  .intro p { font-size: 16px }
  .flow {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 24px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
    text-shadow: none;
  }
  .flow li {
    counter-increment: step;
    padding: 14px;
    border-radius: var(--r-tile);
    background: rgba(37, 37, 37, .7);
    border: 1px solid var(--hair);
    font-size: 13px;
    color: var(--text-2);
  }
  .flow li::before {
    content: counter(step);
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-bottom: 10px;
    border-radius: 50%;
    background: var(--red-stops);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
  }
  .flow b { display: block; color: var(--text); font-size: 14px }
  .card { margin: 0; align-self: center; padding: 28px }
  .after { grid-column: 1 / -1; grid-template-columns: 1fr auto; align-items: center; padding: 24px 0 }
  .support { justify-content: flex-start }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important }
}
