@font-face {
  font-family: "TataHarmony";
  font-style: normal;
  font-weight: 400 700;
  src: url("./assets/fonts/HarmonyOS_SansSC_Medium.ttf") format("truetype");
  font-display: swap;
}

:root {
  --paper: #f5f2ea;
  --ink: #173044;
  --blue: #004773;
  --red: #bd2026;
  --yellow: #f0b23e;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  min-height: 100svh;
  place-items: center;
  background: #343434;
  color: var(--ink);
  font-family: "TataHarmony", sans-serif;
}

button {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

input {
  color: inherit;
  font: inherit;
}

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

.app {
  position: relative;
  width: 100vw;
  height: 100svh;
  min-height: 640px;
  overflow: hidden;
  background: var(--paper);
}

.screen {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, 12px, 0) scale(1.01);
  transition:
    opacity 420ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.screen.is-active {
  z-index: 2;
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
}

.screen.is-exiting {
  z-index: 1;
  opacity: 0;
  transform: translate3d(0, -8px, 0) scale(0.995);
}

.auth-screen {
  --auth-copy-size: clamp(13px, 3.26vw, 14px);
  --auth-logo-size: min(135px, calc(100vw - 88px));
  --auth-input-width: min(173px, calc(100vw - 64px));
  --auth-input-height: 38px;
  --auth-logo-input-gap: 23px;
  --auth-logo-bottom: calc(52px + var(--safe-top));
  --auth-help-top-offset: calc(28px + var(--safe-bottom));
  background: #f7f4ee;
}

.auth-logo {
  position: absolute;
  top: calc(33px + var(--safe-top));
  left: 27px;
  width: 117px;
  height: auto;
  object-fit: contain;
}

.auth-core {
  position: absolute;
  top: var(--auth-logo-bottom);
  bottom: var(--auth-help-top-offset);
  right: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translateY(-15px);
  transform-origin: center;
}

.auth-mark {
  width: var(--auth-logo-size);
  aspect-ratio: 1;
  object-fit: contain;
}

.auth-form {
  width: var(--auth-input-width);
  margin-top: var(--auth-logo-input-gap);
}

.password-input {
  width: 100%;
  height: var(--auth-input-height);
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  outline: 0;
  background: #fff;
  color: #666;
  text-align: center;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
}

.password-input::placeholder {
  color: #ccc;
}

.auth-help-button {
  cursor: pointer;
}

.contact-link-text {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.auth-error-message {
  position: absolute;
  top: calc(50% + 116px);
  left: 50%;
  display: none;
  width: max-content;
  color: #ccc;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.auth-screen[data-state="error"] .auth-error-message {
  display: block;
}

.auth-help-detail {
  position: absolute;
  left: 50%;
  bottom: calc(10px + var(--safe-bottom));
  color: #666;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.auth-screen.is-unlocking .auth-core {
  animation: unlock-core-out 920ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.auth-screen.is-unlocking .auth-help-detail {
  animation: unlock-copy-out 520ms ease forwards;
}

.auth-screen.is-unlocking .auth-logo {
  animation: unlock-copy-out 720ms ease 180ms forwards;
}

@keyframes unlock-core-out {
  0% {
    opacity: 1;
    transform: translateY(-15px) scale(1);
  }

  42% {
    opacity: 1;
    transform: translateY(-25px) scale(1.04);
  }

  100% {
    opacity: 0;
    transform: translateY(-69px) scale(0.92);
  }
}

@keyframes unlock-copy-out {
  to {
    opacity: 0;
  }
}

.contact-screen {
  background-image: url("./assets/contact-page.png");
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
}

.contact-qr-image {
  position: absolute;
  z-index: 3;
  top: 31%;
  left: 50%;
  width: min(210px, 49vw);
  aspect-ratio: 1;
  object-fit: contain;
  opacity: 0.01;
  transform: translateX(-50%);
  -webkit-touch-callout: default;
  user-select: auto;
}

.contact-back-button {
  position: absolute;
  z-index: 4;
  top: calc(33px + var(--safe-top));
  left: 23px;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.72);
  color: rgb(122 125 125 / 0.72);
  cursor: pointer;
  font-size: 0;
}

.contact-back-button::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 11px;
  height: 11px;
  border-bottom: 3px solid currentColor;
  border-left: 3px solid currentColor;
  content: "";
  transform: translate(-35%, -50%) rotate(45deg);
}

.home-screen {
  --home-bottom-clearance: calc(76px + var(--safe-bottom));
  --choice-size: min(171px, 42vw, calc((100svh - 268px - var(--home-bottom-clearance)) / 3));
  padding: calc(33px + var(--safe-top)) 27px calc(24px + var(--safe-bottom));
  background: #f7f4ec;
}

.brand-logo {
  display: block;
  width: 117px;
  height: auto;
  object-fit: contain;
}

.choice-stack {
  display: grid;
  gap: clamp(24px, 3.8svh, 38px);
  justify-items: center;
  margin-top: clamp(40px, 7svh, 64px);
}

.choice {
  display: grid;
  width: var(--choice-size);
  gap: clamp(8px, 1.4svh, 12px);
  justify-items: center;
  cursor: pointer;
}

.choice-dot {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 0 10px 24px rgb(0 0 0 / 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.choice:active .choice-dot {
  transform: scale(0.96);
  box-shadow: 0 5px 15px rgb(0 0 0 / 0.08);
}

.choice-red .choice-dot {
  background: var(--red);
}

.choice-yellow .choice-dot {
  background: var(--yellow);
}

.choice-blue .choice-dot {
  background: var(--blue);
}

.choice-label {
  width: 50%;
  text-align: center;
  font-size: calc(var(--choice-size) * 0.115);
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.home-note {
  position: absolute;
  right: 24px;
  bottom: calc(10px + var(--safe-bottom));
  left: 24px;
  margin: 0;
  display: grid;
  gap: 5px;
  justify-items: center;
  text-align: center;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: rgb(23 48 68 / 0.52);
}

.note-arrow {
  width: 9px;
  height: 9px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(45deg);
  animation: arrow-breathe 1.6s ease-in-out infinite;
}

@keyframes arrow-breathe {
  0%,
  100% {
    opacity: 0.55;
    transform: translateY(2px) rotate(45deg) scale(0.92);
  }

  50% {
    opacity: 1;
    transform: translateY(-2px) rotate(45deg) scale(1.08);
  }
}

.result-screen {
  --theme: var(--blue);
  --bg: url("./assets/result-blue.png");
  background: var(--theme);
  color: #fff;
}

.result-screen[data-color="red"] {
  --theme: var(--red);
  --bg: url("./assets/result-red.png");
}

.result-screen[data-color="yellow"] {
  --theme: var(--yellow);
  --bg: url("./assets/result-yellow.png");
}

.result-art {
  position: relative;
  width: 100%;
  height: 100%;
  padding: calc(68px + var(--safe-top)) 30px calc(56px + var(--safe-bottom));
  background-image: var(--bg);
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
}

.back-button {
  position: absolute;
  z-index: 4;
  top: calc(33px + var(--safe-top));
  left: 23px;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.72);
  color: var(--theme);
  cursor: pointer;
  font-size: 0;
}

.back-button::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 11px;
  height: 11px;
  border-bottom: 3px solid currentColor;
  border-left: 3px solid currentColor;
  content: "";
  transform: translate(-35%, -50%) rotate(45deg);
}

.answer-text {
  position: absolute;
  right: 34px;
  top: 37.5%;
  left: 34px;
  margin: 0;
  color: #fff;
  text-align: center;
  text-wrap: balance;
  font-size: clamp(23px, 6vw, 29px);
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: 0;
  text-shadow: 0 2px 16px rgb(0 0 0 / 0.18);
  opacity: 0;
  transform: translate3d(0, calc(-50% + 18px), 0);
  transition:
    opacity 700ms cubic-bezier(0.22, 1, 0.36, 1) 160ms,
    transform 780ms cubic-bezier(0.22, 1, 0.36, 1) 160ms;
  will-change: opacity, transform;
}

.answer-text.is-visible {
  opacity: 1;
  transform: translate3d(0, -50%, 0);
}

@media (min-width: 768px) and (pointer: fine) {
  .app {
    width: min(100vw, 430px);
    height: min(100svh, 932px);
    max-height: 932px;
    box-shadow: 0 24px 80px rgb(0 0 0 / 0.35);
  }
}

@media (max-height: 690px) {
  .app {
    min-height: 100svh;
  }

  .choice-stack {
    gap: 18px;
    margin-top: 30px;
  }

}

@media (prefers-reduced-motion: reduce) {
  .screen,
  .answer-text,
  .choice-dot,
  .note-arrow {
    transition: none;
    animation: none;
  }
}
