:root {
  color-scheme: dark;
  --gold: #f5c86d;
  --cream: #fff5df;
  --ink: #21190f;
  --navy: #061225;
}

* {
  box-sizing: border-box;
}

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

body {
  display: grid;
  place-items: center;
  min-height: 100svh;
  background:
    radial-gradient(circle at 50% 0%, rgba(238, 192, 105, 0.18), transparent 34%),
    linear-gradient(180deg, #071831 0%, #02050d 100%);
  font-family:
    Pretendard,
    "Apple SD Gothic Neo",
    "Noto Sans KR",
    system-ui,
    sans-serif;
}

@media (min-width: 760px) {
  body {
    background-image:
      linear-gradient(90deg, rgba(3, 7, 22, 0.08) 0%, rgba(3, 7, 22, 0.16) 36%, rgba(3, 7, 22, 0.34) 50%, rgba(3, 7, 22, 0.16) 64%, rgba(3, 7, 22, 0.08) 100%),
      linear-gradient(180deg, rgba(3, 7, 22, 0.08), rgba(3, 7, 22, 0.28)),
      url("../assets/ui/background/current/jellygate-background-desktop.jpg?v=20260714-jellygate-citizens2");
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
  }
}

button,
input {
  font: inherit;
}

.mvp-phone {
  position: relative;
  width: min(100vw, calc(100svh * 9 / 16));
  height: min(100svh, calc(100vw * 16 / 9));
  min-height: 100svh;
  overflow: hidden;
  background: var(--navy);
  box-shadow: 0 0 72px rgba(0, 0, 0, 0.56);
  touch-action: pan-y;
}

@media (min-width: 760px) {
  .mvp-phone {
    border-inline: 1px solid rgba(255, 222, 150, 0.18);
    box-shadow:
      0 0 0 1px rgba(255, 222, 150, 0.12),
      0 28px 90px rgba(0, 0, 0, 0.52);
  }
}

.screen {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateX(0) scale(1.01);
  pointer-events: none;
  transition:
    opacity 260ms ease,
    transform 320ms ease;
}

.screen.is-before {
  transform: translateX(-4%) scale(1);
}

.screen.is-after {
  transform: translateX(4%) scale(1);
}

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

.image-screen img,
.auth-bg,
.profile-bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.tap-zone {
  position: absolute;
  z-index: 3;
  display: block;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.login-zone {
  top: 3%;
  right: 4%;
  width: 25%;
  height: 7%;
}

.start-zone {
  left: 10%;
  bottom: 3.5%;
  width: 80%;
  height: 10%;
}

.back-zone {
  left: 0;
  top: 0;
  width: 50%;
  height: 100%;
}

.next-zone {
  right: 0;
  top: 0;
  width: 50%;
  height: 100%;
}

.finish-zone {
  right: 0;
  top: 0;
  width: 50%;
  height: 100%;
}

.auth-screen::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(4, 8, 20, 0.08) 0%, rgba(4, 8, 20, 0.1) 44%, rgba(3, 6, 14, 0.72) 100%);
  pointer-events: none;
}

.plain-back {
  position: absolute;
  z-index: 5;
  top: max(16px, calc(env(safe-area-inset-top) + 2px));
  left: 14px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 239, 199, 0.36);
  border-radius: 999px;
  background: rgba(11, 17, 35, 0.26);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 10px 24px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.plain-back::before {
  width: 11px;
  height: 11px;
  border-right: 2px solid rgba(255, 245, 221, 0.9);
  border-bottom: 2px solid rgba(255, 245, 221, 0.9);
  content: "";
  transform: translateX(2px) rotate(135deg);
}

.plain-back:active {
  transform: translateY(1px) scale(0.98);
}

.auth-copy {
  position: absolute;
  z-index: 4;
  top: max(58px, calc(env(safe-area-inset-top) + 52px));
  left: 24px;
  right: 24px;
  color: var(--cream);
  text-align: center;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.52);
}

.auth-copy h1 {
  margin: 0;
  color: #ffe49c;
  font-size: clamp(32px, 9vw, 44px);
  line-height: 1.08;
}

.auth-copy p {
  margin: 10px 0 0;
  font-size: clamp(15px, 3.9vw, 17px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.52;
  word-break: keep-all;
}

.accent {
  font-weight: 800;
}

.accent-fortune {
  color: #afe8dc;
  text-shadow: 0 0 8px rgba(88, 219, 195, 0.24);
}

.accent-goods {
  color: #f1d28b;
  text-shadow: 0 0 8px rgba(226, 177, 82, 0.24);
}

.accent-gate {
  color: #eeadbd;
  text-shadow: 0 0 8px rgba(230, 124, 153, 0.24);
}

.social-panel {
  position: absolute;
  z-index: 4;
  right: 14px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 14px;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255, 238, 188, 0.42);
  border-radius: 8px;
  background: rgba(255, 247, 230, 0.88);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.social-button {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  gap: 8px;
  align-items: center;
  width: 100%;
  height: 54px;
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  color: #171717;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
  text-align: center;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

.social-button::after {
  content: "";
}

.social-button:active {
  transform: translateY(1px) scale(0.99);
}

.social-button.is-selected {
  box-shadow:
    0 0 0 3px rgba(255, 248, 223, 0.72),
    0 12px 26px rgba(0, 0, 0, 0.18);
  filter: saturate(1.08);
}

.social-icon {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
  justify-self: center;
}

.social-label {
  min-width: 0;
}

.social-button.kakao {
  background: #fee500;
}

.social-button.naver {
  background: #03c75a;
  color: #fff;
}

.social-button.google {
  border: 1px solid #dadce0;
  background: #fff;
  color: #3c4043;
}

.login-message {
  min-height: 18px;
  margin: 0;
  color: rgba(33, 25, 15, 0.72);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.profile-screen {
  background: #061225;
}

.profile-back {
  background: rgba(9, 16, 34, 0.34);
}

.profile-form {
  position: absolute;
  z-index: 4;
  top: 57.1%;
  right: 7.8%;
  bottom: 3.6%;
  left: 7.8%;
  display: grid;
  grid-template-rows: minmax(82px, 1fr) auto auto auto 12px;
  gap: clamp(4px, 0.62svh, 7px);
  padding-top: 28px;
  color: #3a2511;
}

.profile-heading {
  position: absolute;
  top: 25px;
  left: 22px;
  z-index: 6;
  display: grid;
  gap: 0;
  justify-items: start;
  max-width: 142px;
  pointer-events: none;
  text-align: left;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.profile-heading strong {
  color: #6b3d11;
  font-size: 14px;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1.08;
}

.profile-heading span {
  color: rgba(93, 61, 25, 0.64);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.18;
  word-break: keep-all;
}

.avatar-picker {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  min-height: 82px;
}

.avatar-stage {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 82px;
  isolation: isolate;
}

.avatar-character,
.avatar-pedestal,
.avatar-sparkle {
  position: absolute;
  display: block;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.avatar-character {
  z-index: 3;
  bottom: 12%;
  width: min(37%, 100px);
  min-width: 62px;
  transform-origin: 50% 90%;
  filter: drop-shadow(0 9px 10px rgba(80, 43, 11, 0.22));
  animation: avatar-float 2.8s ease-in-out infinite;
}

.avatar-character.is-switching {
  animation:
    avatar-pop 280ms ease,
    avatar-float 2.8s ease-in-out infinite 280ms;
}

.avatar-pedestal {
  z-index: 1;
  bottom: 4%;
  width: min(63%, 166px);
  opacity: 0.96;
  filter: drop-shadow(0 7px 10px rgba(121, 69, 13, 0.18));
  transform-origin: 50% 50%;
}

.avatar-sparkle {
  z-index: 4;
  bottom: 0;
  width: min(68%, 190px);
  opacity: 0.24;
  animation: sparkle-breathe 2.8s ease-in-out infinite;
}

.avatar-nav {
  position: relative;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(185, 124, 45, 0.35);
  border-radius: 999px;
  background: rgba(255, 246, 222, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    0 5px 10px rgba(95, 52, 11, 0.12);
  cursor: pointer;
}

.avatar-nav::before {
  width: 9px;
  height: 9px;
  border-bottom: 2px solid rgba(111, 65, 14, 0.78);
  border-left: 2px solid rgba(111, 65, 14, 0.78);
  content: "";
}

.avatar-prev::before {
  transform: translateX(2px) rotate(45deg);
}

.avatar-next::before {
  transform: translateX(-2px) rotate(225deg);
}

.avatar-nav:active {
  transform: translateY(1px) scale(0.98);
}

.avatar-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.avatar-option {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 4px;
  align-items: center;
  min-width: 0;
  height: 36px;
  border: 1px solid rgba(166, 106, 34, 0.22);
  border-radius: 8px;
  padding: 4px 6px;
  background: rgba(255, 249, 235, 0.56);
  color: #5b3713;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  cursor: pointer;
}

.avatar-option img {
  width: 25px;
  height: 29px;
  object-fit: contain;
  justify-self: center;
  filter: drop-shadow(0 3px 4px rgba(87, 48, 15, 0.16));
}

.avatar-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-option.is-selected {
  border-color: rgba(190, 118, 31, 0.72);
  background: rgba(255, 238, 189, 0.78);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.72),
    0 0 14px rgba(234, 169, 70, 0.24);
}

.profile-fields {
  display: grid;
  gap: 5px;
}

.profile-field {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  height: 36px;
  border: 1px solid rgba(162, 103, 31, 0.26);
  border-radius: 8px;
  padding: 0 9px;
  background: rgba(255, 250, 239, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.profile-field:focus-within {
  border-color: rgba(181, 106, 25, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 0 0 3px rgba(236, 184, 94, 0.2);
}

.profile-field span {
  color: rgba(91, 55, 19, 0.84);
  font-size: 12px;
  font-weight: 900;
}

.profile-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: #2f1d0e;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
}

.profile-field input::placeholder {
  color: rgba(98, 69, 37, 0.42);
}

.profile-submit {
  width: 100%;
  height: 40px;
  border: 1px solid rgba(120, 71, 17, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 227, 151, 0.98), rgba(222, 139, 41, 0.96)),
    #e59b39;
  color: #3c2208;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 9px 18px rgba(108, 59, 9, 0.22);
  font-size: 15px;
  font-weight: 950;
  letter-spacing: 0;
  cursor: pointer;
}

.profile-submit:disabled {
  cursor: default;
  filter: grayscale(0.36);
  opacity: 0.56;
  box-shadow: none;
}

.profile-submit:not(:disabled):active {
  transform: translateY(1px) scale(0.995);
}

.profile-message {
  min-height: 12px;
  margin: 0;
  color: rgba(89, 54, 17, 0.76);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.mvp-phone[data-current-screen="profile-setup"] .screen-dots {
  opacity: 0;
  pointer-events: none;
}

.screen-dots {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: max(8px, env(safe-area-inset-bottom));
  display: flex;
  gap: 7px;
  transform: translateX(-50%);
}

.screen-dots button {
  width: 6px;
  height: 6px;
  border: 1px solid rgba(255, 232, 172, 0.82);
  border-radius: 999px;
  padding: 0;
  background: rgba(3, 6, 14, 0.42);
}

.screen-dots button.is-active {
  width: 18px;
  background: rgba(255, 219, 139, 0.95);
}

@keyframes avatar-float {
  0%,
  100% {
    transform: translateY(0) rotate(-0.5deg);
  }

  50% {
    transform: translateY(-3px) rotate(0.5deg);
  }
}

@keyframes avatar-pop {
  0% {
    opacity: 0;
    transform: translateY(5px) scale(0.9);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sparkle-breathe {
  0%,
  100% {
    opacity: 0.28;
    transform: scale(0.97);
  }

  50% {
    opacity: 0.58;
    transform: scale(1.02);
  }
}

@media (min-width: 760px) {
  .mvp-phone {
    min-height: auto;
    border-inline: 1px solid rgba(255, 235, 185, 0.18);
  }
}

@media (max-height: 700px) {
  .profile-form {
    grid-template-rows: minmax(74px, 1fr) auto auto auto 10px;
    gap: 4px;
    padding-top: 24px;
  }

  .profile-heading {
    top: 20px;
    left: 20px;
    max-width: 132px;
  }

  .profile-heading strong {
    font-size: 13px;
  }

  .profile-heading span {
    font-size: 9px;
  }

  .avatar-picker,
  .avatar-stage {
    min-height: 74px;
  }

  .avatar-character {
    width: min(34%, 90px);
    min-width: 58px;
  }

  .avatar-pedestal {
    width: min(58%, 148px);
  }

  .avatar-sparkle {
    width: min(62%, 168px);
  }

  .avatar-option {
    height: 34px;
    font-size: 10px;
  }

  .avatar-option img {
    width: 23px;
    height: 27px;
  }

  .profile-field {
    height: 34px;
  }

  .profile-submit {
    height: 38px;
  }

  .profile-message {
    min-height: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen,
  .social-button,
  .avatar-character,
  .avatar-character.is-switching,
  .avatar-pedestal,
  .avatar-sparkle {
    transition: none;
    animation: none;
  }
}
