.hidden {
    opacity: 0;
    transition:
      opacity 1s ease-in-out;
}

/* Prevent all text selection globally */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Prevent all touch gestures globally (zoom, pan, etc.) */
* {
    touch-action: none;
    -ms-touch-action: none;
}

/* Allow interaction only on intended interactive elements */
#add-to-apple-wallet,
#add-to-google-wallet,
#add-to-samsung-wallet,
#add-to-wallet-button,
#sig-logo,
#errorIcon,
#log-output {
    touch-action: manipulation;
    -ms-touch-action: manipulation;
    pointer-events: auto;
    cursor: pointer;
}

/* Prevent blue flash on mobile for logo and body when toggling color mode */
#sig-logo,
#sig-logo:active,
#sig-logo:focus {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    outline: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow body to receive clicks for unbranded mode toggle */
body[id="body"] {
    pointer-events: auto;
    cursor: default;
}

/* Prevent blue flash on mobile for body when toggling color mode */
body[id="body"]:active,
body[id="body"]:focus {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    outline: none;
}

/* Prevent interaction on all other elements */
#main-content,
#signature,
#card-container,
#card-image,
#card-background,
#loading-icon,
#loading-indicator,
#loading-bar,
#signature-top-row,
#signature-bottom-row,
#signature-top-text,
#signature-bottom-text {
    pointer-events: none;
}

#loading-screen {
    pointer-events: auto;
    z-index: 300;
}


html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-width: 100vw;
  overflow: hidden;
  touch-action: none;
  -ms-touch-action: none;
  overscroll-behavior-x: none;
  overscroll-behavior-y: contain;
  /* Prevent zoom gestures */
  -ms-content-zooming: none;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html {
  /* Extend background into safe area (dynamic island, camera bump) */
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  min-height: calc(100vh + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px));
}

body {
  position: fixed;
  top: calc(-1 * env(safe-area-inset-top, 0px));
  left: calc(-1 * env(safe-area-inset-left, 0px));
  right: calc(-1 * env(safe-area-inset-right, 0px));
  bottom: calc(-1 * env(safe-area-inset-bottom, 0px));
  margin: 0;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  width: calc(100% + env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px));
  height: calc(100% + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: default;
  pointer-events: none;
  transition:
    background-color 0.5s ease-in-out;
}

#signature {
  max-width: 150px;
  position: absolute;
  opacity: 0;
  z-index: 0;
  transition:
    opacity 0.33s ease-in;
}

#sig-logo {
  max-width: 150px;
}

#main-content {
  display: flex;
  overflow: hidden;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  transform: scale(1, 0);
  opacity: 0;
  z-index: 1;
  transition: 
    background-color 0.5s ease,
    color 0.5s ease,
    transform 0.35s ease-in-out,
    height 0.5s ease-in-out,
    width 0.5s ease-in-out,
    opacity 0.33s ease-in,
    border-radius 2s ease-out;
}

#main-content h3, #main-content p {
  transition: color 0.5s ease-in-out,
}

#errorIcon,
#successIcon {
  opacity: 0;
  min-height: 20px;
  min-width: 20px;
  max-height: 80px;
  max-width: 80px;
  transition:
    opacity 1s ease-in;
}

#successHeading,
#successMessage,
#suggestedUserAction {
  opacity: 0;
  transition:
    color 0.5s ease-in-out,
    opacity 0.75s ease-in;
}

#successHeading,
#errorHeading {
  font-weight: 500;
}

#errorHeading,
#errorMessage,
#error-message,
#suggestedUserAction {
    color: var(--main-text-color, #000000);
}


#card-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition:
    opacity 75s ease-in,
    box-shadow 0.3s ease-in-out;
  }

.card-art {
    border-radius: 15px;
    min-width: 75px;
    transition:
      opacity 0.3s ease-in,
      box-shadow 0.3s ease-in-out;
}

#card-image {
  background-size: cover;
  background-position: center;
  z-index: 0;
}

#card-background{
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: #014b6a;
  background-size: cover;
  background-position: center;
  z-index: -1;
  transition: opacity 0.3s ease-in;
}

#apple-card-logo {
  position: absolute;
  z-index: 1;
}

#add-to-apple-wallet{
  min-height: 10mm;
  max-height: 100mm;
  cursor: pointer;
}

#add-to-google-wallet{
  min-height: 10mm;
  max-height: 100mm;
  cursor: pointer;
}

  /* Loading styles */

  #loading-screen {
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    z-index: 300;
    pointer-events: auto;
    min-width: 100vw;
    transition:
      display 0.75s ease-in-out,
      opacity 0.33s ease-in;
  }

  #loading-screen.loaded {
    opacity: 1;
  }

  #loading-icon {
    position: relative;
    /* Auto-applied from iconMap via CSS variable - CSS handles the image */
    background-image: var(--loading-icon-url);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    align-self: center;
    /* Prevent any transitions that could cause sliding */
    transition: none;
  }


  #loading-indicator{
    display: flex;
    background-color: transparent;
    transition:
      width 0.7s ease-in-out,
      box-shadow ease,
      opacity 1s ease-in;
  }

  .loading-bar {
    justify-content: flex-start;
  }

  #loading-bar {
    width: 0;
    height: 100%;
    display: flex;
    transition:
      width 0.4s ease,
      box-shadow ease;
    background-color: var(--loading-indicator-color, #9ba7aa);
  }

  .loading-spinner-container {
    align-items: anchor-center;
    justify-content: center;
  }

  #loading-wait-text {
    color: var(--main-text-color, #000000);
  }

  /* Ring Spinner */
  .lds-ring {
    transition:
      opacity 1s ease-out;
  }

  #loading-spinner.lds-ring {
    position: relative;
    color: var(--loading-indicator-color, #000000);
  }

  #loading-spinner.lds-ring div {
    position: absolute;
    border-color: currentColor transparent transparent transparent;
    border-radius: 50%;
    animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  }

  .lds-ring div:nth-child(1) {
    animation-delay: -0.48s;
  }
  .lds-ring div:nth-child(2) {
    animation-delay: -0.36s;
  }
  .lds-ring div:nth-child(3) {
    animation-delay: -0.24s;
  }
  @keyframes lds-ring {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }

  /* Orb Spinner */
  .lds-ellipsis {
    position: relative;
    transition:
      opacity 1s ease-out;
  }

  .lds-ellipsis div {
    position: absolute;
    /* border-radius: 50%; */
    background: currentColor;
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
    transition:
      transform 0.6s ease,
      box-shadow 0.6s,
      opacity 1s ease-in,
      background-color 0.5s ease-in-out;
      
  }

  .lds-ellipsis div:nth-child(1) {
      left: 8px;
      animation: lds-ellipsis1 0.6s infinite;
  }
  .lds-ellipsis div:nth-child(2) {
    left: 8px;
    animation: lds-ellipsis2 0.6s infinite;
  }
  .lds-ellipsis div:nth-child(3) {
    left: 32px;
    animation: lds-ellipsis2 0.6s infinite;
  }
  .lds-ellipsis div:nth-child(4) {
    left: 56px;
    animation: lds-ellipsis3 0.6s infinite;
  }
  .lds-ellipsis div:nth-child(5) {
    left: 56px;
    box-shadow: 0.25px 0.5px 0.5px rgba(0, 0, 0, 0.75);
    animation: lds-ellipsis3 0.6s infinite;
  } 
    
  @keyframes lds-ellipsis1 {
      0% {transform: scale(0);}
      100% {transform: scale(1);}
    }
  @keyframes lds-ellipsis3 {
    0% {transform: scale(1);}
    100% {transform: scale(0);}
  }
  @keyframes lds-ellipsis2 {
    0% {transform: translate(0, 0);}
    100% {transform: translate(24px, 0);}
  }
  @keyframes lds-ellipsis4 {
    0% {transform: scale(0);}
    100% {transform: scale(1);}
  }


@media (orientation: landscape) {

  #main-content {
    padding-top: 5vh;
    padding-bottom: 2vh;
    padding-left: 3.5vw;
    padding-right: 3.5vw;
    max-height: 80vh;
    max-width: 50vw;
    min-width: 75px;
}

  #errorIcon,
  #successIcon {
    width: 15vw;
    height: auto;
  }

  #loading-icon {
    position: relative;
    min-height: 50px;
    max-height: 200px;
    height: 35vw;
    width: auto;
    background-image: var(--loading-icon-url);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    align-self: center;
    transition: none;
  }

  #loading-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-width: 100vw;
    opacity: 0;
    z-index: 300;
    pointer-events: auto;
    transition:
      display 0.75s ease-in-out,
      opacity 0.33s ease-in;
  }


  #loading-indicator{
      max-width: 400px;
      width: 50vw;
  }

  .loading-bar {
    justify-content: flex-start;
  }

  #loading-bar {
    height: 2vw;
  }

  .loading-spinner-container {
    gap: 0.5vh;
  }

  #loading-wait-text {
    margin-left: 3vw;
    color: var(--main-text-color, #000000);
  }

  /* Ring Spinner */
  .lds-ring {
    transition:
      opacity 1s ease-out;
  }

  #loading-spinner.lds-ring {
    position: relative;
    width: 2vw;
    height: 2vw;
    max-height: 500px;
    color: var(--loading-indicator-color, #000000);
  }

  #loading-spinner.lds-ring div {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 0.75vw solid currentColor;
    border-color: currentColor transparent transparent transparent;
    border-radius: 50%;
    animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  }

  .lds-ring div:nth-child(1) {
    animation-delay: -0.48s;
  }
  .lds-ring div:nth-child(2) {
    animation-delay: -0.36s;
  }
  .lds-ring div:nth-child(3) {
    animation-delay: -0.24s;
  }
  @keyframes lds-ring {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }

  /* Card container */

  #card-container {
    max-width: min(100%, 86mm);
    max-height: 54mm;
    min-width: 100px;
    margin-bottom: 3vh;
  }

  .card-art {
      min-width: 75px;
      height: auto;
  }

  #card-image {
    max-width: min(100%, 86mm);
    max-height: 54mm;
    height: auto;
    border-radius: 15px;
  }

  #apple-card-logo {
    top: 8%;
    left: 5%;
    height: 17%;
  }


  #add-to-apple-wallet{
    height: 12vh;
  }

  #add-to-google-wallet{
    height: 12vh;
  }

  /* Debug content */
  #log-output {
      flex-direction: column;
      display: flex;
      align-items: flex-start;
      text-align: left;
      padding-top: 1vh;
      padding-bottom: 1vh;
      overflow-y: scroll;
      overflow-x: none;
      opacity: 0;
      mask-image: linear-gradient(to bottom, transparent 0%, black 5%, black 90%, transparent 100%);
      -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 5%, black 90%, transparent 100%);
      scrollbar-width: none;
      -ms-overflow-style: none;
      touch-action: pan-y;
      transition:
        opacity 0.5s ease;
  }

  #log-output ul li {
      transition: opacity 0.5s ease-in;
  }

  #log-output ul li.visible {
      opacity: 1;
  }



  #signature-bottom-row > p {
      margin-top: 3px;
  }

  /* Icons are auto-applied via CSS variables from iconMap */
  /* Set empty/transparent src to allow CSS background-image to show */

  #sig-logo {
      transition: content 0.5s ease, 0.5s ease;
  }


  /* Orb Spinner */
  .lds-ellipsis {
    width: 80px;
    height: 80px;
  }

  .lds-ellipsis div {
    top: 33.33333px;
    width: 13.33333px;
    height: 13.33333px;
  }

}

@media (orientation: portrait) {

  #main-content {
      padding-top: 5vh;
      padding-bottom: 3vh;
      padding-left: 3.5vw;
      padding-right: 3.5vw;
      margin-left: 5vw;
      margin-right: 5vw;
      max-height: 500px;
      max-width: 500px;
      min-width: 75px;
  }

  #errorIcon,
  #successIcon {
    width: 15vh;
    height: auto;
  }

  #main-content.error-state #errorIcon,
  #main-content.success-state #successIcon {
      margin-bottom: 1vh;
  }

#loading-icon {
  position: relative;
  min-height: 50px;
  max-height: 200px;
  height: 35vw;
  width: auto;
  background-image: var(--loading-icon-url);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  align-self: center;
  transition: none;
}

#loading-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 100vw;
  opacity: 0;
  z-index: 300;
  pointer-events: auto;
  transition:
    display 0.75s ease-in-out,
    opacity 0.33s ease-in;
}



#loading-indicator{
    max-width: 400px;
    width: 50vw;

}

.loading-bar {
  justify-content: flex-start;
}

#loading-bar {
  height: 2vh;
}

.loading-spinner-container {
  gap: 0.5vh;
}

#loading-wait-text {
  margin-left: 3vw;
  color: var(--main-text-color, #000000);
}

/* Ring Spinner */
.lds-ring {
  transition:
    opacity 1s ease-out;
}

#loading-spinner.lds-ring {
  position: relative;
  width: 2vw;
  height: 2vw;
  max-height: 500px;
  color: var(--loading-indicator-color, #000000);
}

#loading-spinner.lds-ring div {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 0.75vw solid currentColor;
  border-color: currentColor transparent transparent transparent;
  border-radius: 50%;
  animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.lds-ring div:nth-child(1) {
  animation-delay: -0.48s;
}
.lds-ring div:nth-child(2) {
  animation-delay: -0.36s;
}
.lds-ring div:nth-child(3) {
  animation-delay: -0.24s;
}
@keyframes lds-ring {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

  /* Card container */

  #card-container {
    max-width: min(100%, 86mm);
    max-height: 54mm;
    min-width: 100px;
    margin-top: -1vh;
    margin-bottom: 3vh;
  }

  .card-art {
      min-width: 75px;
      height: auto;
  }

  #card-image {
    max-width: min(100%, 86mm);
    max-height: 54mm;
    width: 100%;
    height: auto;
  }


  #apple-card-logo {
    top: 8%;
    left: 5%;
    height: 17%;
  }


  #add-to-apple-wallet{
    height: 8vh;
  }

  #add-to-google-wallet{
    height: 8vh;
  }

  /* Debug content */
  #log-output {
      flex-direction: column;
      display: flex;
      align-items: flex-start;
      text-align: left;
      padding-top: 1vh;
      padding-bottom: 1vh;
      overflow-y: scroll;
      overflow-x: none;
      opacity: 0;
      mask-image: linear-gradient(to bottom, transparent 0%, black 5%, black 90%, transparent 100%);
      -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 5%, black 90%, transparent 100%);
      scrollbar-width: none;
      -ms-overflow-style: none;
      touch-action: pan-y;
      transition:
        opacity 0.5s ease;
  }

  #log-output ul li {
      transition: opacity 0.5s ease-in;
  }

  #log-output ul li.visible {
      opacity: 1;
  }

  #signature-bottom-row > p {
      margin-top: 3px;
  }

  #sig-logo {
      transition: content 0.5s ease, 0.5s ease;
  }


  /* Orb Spinner */
  .lds-ellipsis {
    position: relative;
    width: 80px;
    height: 80px;
    transition:
      opacity 1s ease-out;
  }

  .lds-ellipsis div {
    position: absolute;
    top: 33.33333px;
    width: 13.33333px;
    height: 13.33333px;
    /* border-radius: 50%; */
    background: currentColor;
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
    transition:
      transform 0.6s ease,
      box-shadow 0.6s,
      opacity 1s ease-in,
      background-color 0.5s ease-in-out;
      
  }

  .lds-ellipsis div:nth-child(1) {
      left: 8px;
      animation: lds-ellipsis1 0.6s infinite;
  }
  .lds-ellipsis div:nth-child(2) {
    left: 8px;
    animation: lds-ellipsis2 0.6s infinite;
  }
  .lds-ellipsis div:nth-child(3) {
    left: 32px;
    animation: lds-ellipsis2 0.6s infinite;
  }
  .lds-ellipsis div:nth-child(4) {
    left: 56px;
    animation: lds-ellipsis3 0.6s infinite;
  }
  .lds-ellipsis div:nth-child(5) {
    left: 56px;
    box-shadow: 0.25px 0.5px 0.5px rgba(0, 0, 0, 0.75);
    animation: lds-ellipsis3 0.6s infinite;
  } 
    
  @keyframes lds-ellipsis1 {
      0% {transform: scale(0);}
      100% {transform: scale(1);}
    }
  @keyframes lds-ellipsis3 {
    0% {transform: scale(1);}
    100% {transform: scale(0);}
  }
  @keyframes lds-ellipsis2 {
    0% {transform: translate(0, 0);}
    100% {transform: translate(24px, 0);}
  }
  @keyframes lds-ellipsis4 {
    0% {transform: scale(0);}
    100% {transform: scale(1);}
  }

  /* Error text */
  #errorHeading,
  #errorMessage,
  #error-message,
  #suggestedUserAction {
      color: var(--main-text-color, #000000);
  }


  /* Icon margin for error/success icons */
  #main-content.error-state #errorIcon,
  #main-content.success-state #successIcon {
      margin-bottom: 1vh;
  }
}