:root {
  --accent: #6554b8;
  --accent-hover: #514198;
  --text: #252532;
  --hint: #707579;
  --err: #e53935;
  --field-border: #dfe1e5;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }

body {
  margin: 0;
  background: #ffffff;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

#auth-qr-form {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.view { display: block; }
.hidden { display: none !important; }

h1 {
  font-size: 22px;
  font-weight: 500;
  margin: 24px 0 0;
  letter-spacing: -0.2px;
}

.subtitle {
  font-size: 14px;
  color: var(--hint);
  line-height: 1.5;
  margin: 14px 0 26px;
  padding: 0 8px;
}


.qr-outer {
  width: 280px;
  height: 280px;
  position: relative;
  margin: 0 auto;
}
.qr-inner {
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 280px;
  display: flex;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
}
.qr-inner.open {
  animation: 0.4s ease-in-out forwards qr-show;
}
@keyframes qr-show {
  0%   { opacity: 0; transform: scale(0.7); }
  50%  { opacity: 1; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}
.qr-container {
  background-color: #fff;
  border-radius: 1.5rem;
  overflow: hidden;
}
.qr-container svg { display: block; }


.qr-plane {
  z-index: 1;
  width: 54px;
  height: 54px;
  background-color: var(--accent);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-plane svg { width: 100%; height: 100%; }

.qr-loading {
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 280px;
  display: flex;
  position: absolute;
  top: 0;
  left: 0;
}
.spinner {
  width: 40px; height: 40px;
  border: 4px solid #e6e6e6;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


#auth-qr-form ol {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 22px auto 28px;
  max-width: 300px;
  text-align: left;
}
#auth-qr-form ol li {
  counter-increment: step;
  position: relative;
  padding-left: 36px;
  font-size: 14px;
  line-height: 1.45;
  color: #222;
  margin-bottom: 16px;
}
#auth-qr-form ol li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -1px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
#auth-qr-form ol b { font-weight: 500; }


.auth-logo { width: 120px; height: 120px; margin: 0 auto; }
.auth-logo svg { width: 100%; height: 100%; }


.field { position: relative; margin: 0 0 18px; }
.field input {
  width: 100%;
  padding: 15px 14px;
  font-size: 16px;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--text);
}
.field input:focus { border-color: var(--accent); border-width: 2px; padding: 14px 13px; }
.field label {
  position: absolute;
  left: 12px;
  top: 15px;
  font-size: 16px;
  color: var(--hint);
  background: #fff;
  padding: 0 5px;
  pointer-events: none;
  transition: all .15s ease;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label {
  top: -8px;
  font-size: 12px;
  color: var(--accent);
}
.field input:not(:focus):not(:placeholder-shown) + label { color: var(--hint); }


.country-field { position: relative; }
.country-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 14px;
  font-size: 16px;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.country-btn .flag { width: 24px; height: 18px; border-radius: 3px; object-fit: cover; flex: 0 0 auto; }
.country-btn #country-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.country-btn .chevron { width: 20px; height: 20px; color: var(--hint); flex: 0 0 auto; transition: transform .15s; }
.country-field.open .country-btn { border-color: var(--accent); border-width: 2px; padding: 14px 13px; }
.country-field.open .country-btn .chevron { transform: rotate(180deg); }

.country-list {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  overflow: hidden;
}
.country-search {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: none;
  border-bottom: 1px solid var(--field-border);
  outline: none;
  background: #fff;
  color: var(--text);
}
.country-options {
  max-height: 260px;
  overflow-y: auto;
  
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color .3s;
}
.country-options:hover { scrollbar-color: rgba(120,130,140,.5) transparent; }
.country-options::-webkit-scrollbar { width: 6px; }
.country-options::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 6px;
}
.country-options:hover::-webkit-scrollbar-thumb { background-color: rgba(120,130,140,.5); }
.country-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 15px;
}
.country-option:hover, .country-option.active { background: rgba(101,84,184,.1); }
.country-option .flag { width: 24px; height: 18px; border-radius: 3px; object-fit: cover; flex: 0 0 auto; }
.country-option .c-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.country-option .c-dial { color: var(--hint); font-size: 14px; }


.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .5px;
  cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: var(--accent-hover); }

.btn-link {
  margin-top: 22px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .4px;
  cursor: pointer;
  font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }


.success-check {
  width: 96px; height: 96px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pop .3s ease;
}
.success-check svg { width: 52px; height: 52px; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.msg { margin-top: 16px; font-size: 14px; min-height: 20px; }
.msg.error { color: var(--err); }
.msg.ok { color: #4caf50; }



/* Independent application layout */
body { height: auto; min-height: 100%; background: #f4f4f7; padding: 40px 16px; }
#auth-qr-form { max-width: 480px; padding: 32px; background: #fff; border: 1px solid #e4e4ec; border-radius: 16px; box-shadow: 0 12px 36px rgba(35,30,60,.06); text-align: left; }
.page-header { display: flex; align-items: center; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid #ededf2; }
.app-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: #eeeaf8; color: var(--accent); font-size: 14px; font-weight: 700; }
.app-name { margin: 0; font-size: 17px; font-weight: 650; }
.app-description { margin: 4px 0 0; font-size: 13px; color: var(--hint); }
.service-note { margin: 18px 0 26px; color: #646473; font-size: 13px; line-height: 1.6; }
h1 { font-size: 23px; font-weight: 650; margin: 22px 0 0; }
.subtitle { padding: 0; }
.qr-container { border-radius: 8px; }
.qr-plane { display: none; }
#auth-qr-form ol { max-width: none; }
#auth-qr-form ol li::before { border-radius: 6px; background: #eeeaf8; color: var(--accent); }
.auth-logo { width: 44px; height: 44px; margin: 0; padding: 10px; background: #eeeaf8; color: var(--accent); border-radius: 10px; }
.btn { font-family: inherit; font-weight: 600; letter-spacing: 0; border-radius: 8px; }
.btn-link { width: 100%; padding: 12px; margin-top: 16px; border: 1px solid var(--field-border); border-radius: 8px; letter-spacing: 0; color: #484354; }
.btn-link:hover { background: #f6f4fa; text-decoration: none; }
button:focus-visible, .country-search:focus-visible { outline: 3px solid #b6a9e7; outline-offset: 3px; }
.success-check { width: 56px; height: 56px; margin: 0; border-radius: 12px; background: #46816a; }
.success-check svg { width: 32px; height: 32px; }
@media (max-width: 520px) {
  body { padding: 16px 12px; align-items: flex-start; }
  #auth-qr-form { padding: 24px 16px; }
  h1 { font-size: 21px; }
}
@media (max-width: 340px) {
  body { padding: 8px 0; }
  #auth-qr-form { padding: 20px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; }
}

/* Wide desktop layout with a separate QR panel. */
#auth-qr-form { max-width: 480px; padding: 0; overflow: visible; }
.page-header { padding: 22px 28px; background: #292735; color: #fff; border: 0; border-radius: 15px 15px 0 0; }
.app-description { color: #d0cbdc; }
.service-note { margin: 0; padding: 18px 28px; background: #f8f7fb; border-bottom: 1px solid #e4e4ec; }
.auth-form { padding: 32px; }
.auth-form.qr { display: grid; grid-template-columns: 280px minmax(0, 1fr); align-items: center; gap: 32px; }
.qr-outer { outline: 1px solid #e4e4ec; border-radius: 8px; }
.section-label { margin: 0 0 10px; color: var(--accent); font-size: 11px; letter-spacing: 1.5px; font-weight: 700; }
.qr-details h1 { margin: 0; }
#auth-qr-form ol { list-style: decimal; padding-left: 20px; margin: 20px 0; }
#auth-qr-form ol li { padding-left: 4px; margin-bottom: 12px; }
#auth-qr-form ol li::before { content: none; }
#view-phone, #view-password { max-width: 440px; margin: 0 auto; }
.msg { margin: 0; padding: 0 28px 20px; }
@media (max-width: 680px) {
  #auth-qr-form { max-width: 480px; padding: 0; }
  .auth-form.qr { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .auth-form { padding: 24px; }
  .page-header, .service-note { padding: 18px 24px; }
}
@media (max-width: 360px) {
  .auth-form { padding: 20px 8px; }
  .page-header, .service-note { padding: 16px; }
}
