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

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  overflow-x: hidden;
  background: #EAEFF8;
  font-family: Montserrat, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #000;
  display: flex;
  justify-content: center;
}

/* Fluid, centered recreation of the Figma frame (was a fixed 1920×968 stage) */
.stage {
  width: 100%;
  max-width: 1200px;
  padding: 32px 20px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
}

.header-logo {
  width: 271px;
  max-width: 60%;
  height: auto;
}

.title {
  /* Colo Pro Black is licensed and not embedded; heavy sans fallback */
  font-family: "Colo Pro Black", "Arial Black", Montserrat, sans-serif;
  font-weight: 900;
  font-size: clamp(30px, 6vw, 62px);
  line-height: 1.05;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.title .mark {
  font-family: Montserrat, sans-serif; /* a tapered ! you prefer */
  font-weight: 800;
  letter-spacing: 0;
}

.heading {
  max-width: 763px;
  font-weight: 700;
  font-size: clamp(18px, 3vw, 26px);
  line-height: 1.25;
}

/* Partner logo row (wraps on narrow screens) */
.partners {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 20px 40px;
}
.partner { display: block; width: auto; height: 40px; }
.partner-vn  { height: 38px; }
.partner-fpv { height: 32px; }

/* White content card — holds each page's content */
.card {
  width: 100%;
  max-width: 771px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 11.6px -2px rgba(0,0,0,0.25);
  padding: clamp(24px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

/* --- Login card content --- */
.intro { font-weight: 400; font-size: 15px; line-height: 1.4; }
.steps-title { font-weight: 700; font-size: 15px; }
.steps { width: 100%; font-size: 15px; line-height: 1.4; text-align: left; padding-left: 20px; }
.steps li { margin-bottom: 8px; }
.steps b { font-weight: 600; }
.footer { font-size: 15px; line-height: 1.4; }

/* Google sign-in button (design style: white, bordered) */
.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 364px;
  min-height: 60px;
  padding: 0 24px;
  border-radius: 6px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #C4C4C4;
  text-decoration: none;
  cursor: pointer;
}
.google-btn img { height: 24px; width: auto; }
.google-btn span { font-weight: 600; font-size: 18px; color: #000; }

/* --- Shared card content (verification flow + status pages) --- */

.card h1, .card h2, .card h3 { font-weight: 700; line-height: 1.2; }
.card h2 { font-size: clamp(20px, 3vw, 24px); }
.card p { font-size: 15px; line-height: 1.45; }
.card a:not(.button):not(.google-btn) { color: #1a56db; text-decoration: underline; }

/* Primary action button (Diia): dark, to stand out on the white card */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  padding: 16px 28px;
  border-radius: 8px;
  background: #222;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.3s;
}
.button:hover { background: #444; }

/* --- QR verification page --- */

.checkbox-container {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  max-width: 560px;
  text-align: left;
}
#diia_label { transition: all 0.3s ease; font-size: 14px; }

#diia_button { display: inline; vertical-align: middle; width: 32px; }

#wrapper { position: relative; width: 100%; display: flex; justify-content: center; }
#diia_qr { position: relative; display: none; transition: filter 0.5s ease-in-out; text-align: center; }
/* QR code display: centered white square with rounded corners + shadow */
.qr-frame {
  display: grid;
  place-items: center;
  width: 240px;
  height: 240px;
  max-width: 100%;
  margin: 8px auto 0;
  padding: 16px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.qr-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
#diia_button_img { width: 200px; max-width: 100%; }

#expired-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
  padding: 12px 20px;
  border-radius: 8px;
  display: none;
}
#reload_link { color: #ccc; }

/* Desktop / mobile toggles — driven by the UA check in JS (adds `.is-mobile` to
   <html>), which is the same signal that decides whether the QR image is
   populated. Keying off the UA (not a viewport breakpoint) keeps the framed QR
   box and the deep-link button in sync with it: a mobile UA on a wide screen no
   longer shows an empty QR frame, and a narrow desktop window still gets the QR. */
.mobile-button { display: none; }
.desktop { display: block; }
#code_word_desktop { display: inline; }
#code_word_mobile { display: none; }

.is-mobile .mobile-button { display: block; }
.is-mobile .desktop { display: none; }
.is-mobile .qr-frame { display: none; }
.is-mobile #code_word_desktop { display: none; }
.is-mobile #code_word_mobile { display: inline; }

/* Fullscreen loader */
#loader { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 9999; }
.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(0, 0, 0, 0.1);
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Consent-label attention shake */
.bounce { animation: bounceEffect 0.5s ease-in-out 3; color: #ff6347; }
@keyframes bounceEffect {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Screen-reader-only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Sign-out link for authenticated visitors */
.logout {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 14px;
  color: #000;
}

/* ---------------------------------------------------------------------------
   Modal dialog (service rules). Built on the native <dialog> element, so the
   backdrop, ESC-to-close and focus trapping come from the browser.
--------------------------------------------------------------------------- */

.modal {
  width: min(600px, 92vw);
  max-height: min(82vh, 760px);
  margin: auto;                 /* centres the dialog in the top layer */
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: #fff;
  color: #000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;             /* let the rounded corners clip the scroll area */
  display: none;
  flex-direction: column;
}
.modal[open] { display: flex; animation: modalIn 0.2s ease-out; }
.modal::backdrop { background: rgba(16, 24, 40, 0.55); }

/* Fallback for browsers without dialog.showModal() */
.modal.modal-fallback { position: fixed; inset: 0; z-index: 10000; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .modal[open] { animation: none; }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #E5E7EB;
}
.modal-title {
  font-size: clamp(17px, 2.4vw, 21px);
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
}
.modal-close {
  flex: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: #F3F4F6;
  color: #333;
  font-family: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s;
}
.modal-close:hover { background: #E5E7EB; }

.modal-body {
  padding: 4px 24px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  text-align: left;
}
.modal-body h3 { margin: 18px 0 6px; font-size: 15px; font-weight: 700; }
.modal-body p, .modal-body li { font-size: 14px; line-height: 1.55; }
.modal-body ul { margin: 0 0 6px; padding-left: 20px; }
.modal-body li { margin-bottom: 4px; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid #E5E7EB;
}
.modal-foot .button { border: 0; font-family: inherit; font-size: 15px; }

/* Keep the page behind the dialog from scrolling */
body.modal-open { overflow: hidden; }

/* Full-width bottom sheet on phones */
@media only screen and (max-width: 560px) {
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    margin: auto auto 0;        /* dock to the bottom of the screen */
    border-radius: 16px 16px 0 0;
  }
  .modal-head { padding: 16px 18px 12px; }
  .modal-body { padding: 4px 18px 16px; }
  .modal-foot { padding: 12px 18px; }
  .modal-foot .button { width: 100%; }
}
