:root {
  --ink: #151518;
  --muted: #77747f;
  --line: #ece8df;
  --paper: #fffdf8;
  --cream: #fff5d4;
  --gold: #ffc84c;
  --gold-dark: #d49308;
  --violet: #5f5be8;
  --violet-soft: #ebeaff;
  --mint: #dff5ee;
  --rose: #ffe9ee;
  --blue: #e7f1ff;
  --shadow: 0 24px 60px rgba(27, 23, 36, 0.16);
}

@font-face {
  font-family: "Pretendard";
  src: url("./Pretendard-1.3.9/web/static/woff2/Pretendard-Regular.woff2") format("woff2");
  font-weight: 400;
}

@font-face {
  font-family: "Pretendard";
  src: url("./Pretendard-1.3.9/web/static/woff2/Pretendard-SemiBold.woff2") format("woff2");
  font-weight: 600;
}

@font-face {
  font-family: "Pretendard";
  src: url("./Pretendard-1.3.9/web/static/woff2/Pretendard-ExtraBold.woff2") format("woff2");
  font-weight: 800;
}

@font-face {
  font-family: "Pretendard";
  src: url("./Pretendard-1.3.9/web/static/woff2/Pretendard-Black.woff2") format("woff2");
  font-weight: 900;
}

* {
  box-sizing: border-box;
}

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

#root {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 22% 8%, rgba(255, 200, 76, 0.22), transparent 26rem),
    linear-gradient(140deg, #fffaf0 0%, #fbfbff 46%, #eef9f4 100%);
  color: var(--ink);
  font-family:
    "Pretendard", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.page {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.phone-shell {
  width: min(100%, 430px);
  min-height: min(850px, calc(100vh - 36px));
  background: var(--paper);
  border: 1px solid rgba(21, 21, 24, 0.08);
  border-radius: 32px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.app-header {
  height: calc(88px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(28px + env(safe-area-inset-top, 0px)) 26px 14px;
  flex: 0 0 auto;
}

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

.icon-row {
  display: flex;
  gap: 10px;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #696674;
  display: grid;
  place-items: center;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: #f4f1eb;
  color: var(--ink);
  outline: 0;
}

.icon-button:active {
  transform: scale(0.95);
}

.icon-button svg,
.circle-button svg {
  width: 24px;
  height: 24px;
}

.screen {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 14px 26px 24px;
}

.question {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  text-wrap: balance;
}

.hero-title {
  margin: 0 0 12px;
  display: flex;
  justify-content: center;
}

.hero-title-image {
  display: block;
  width: clamp(220px, 68vw, 310px);
  height: auto;
  object-fit: contain;
}

.subcopy {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-wrap: balance;
}

.hero-stage .subcopy {
  max-width: 320px;
  margin: 0 auto 24px;
  font-size: clamp(15px, 4vw, 17px);
  line-height: 1.45;
}

.hero-stage {
  flex: 1;
  min-height: 430px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
  text-align: center;
}

.hero-visual {
  width: min(76vw, 280px);
  aspect-ratio: 1;
  border-radius: 18px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.primary-action,
.secondary-action {
  width: 100%;
  min-height: 62px;
  border: 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 800;
}

.primary-action {
  background: var(--gold);
  color: #312207;
  box-shadow: 0 10px 24px rgba(255, 200, 76, 0.34);
}

.secondary-action {
  background: var(--violet);
  color: #fff;
}

.ghost-action {
  border: 1px solid var(--line);
  background: #fff;
  color: #3e3b45;
  border-radius: 10px;
  min-height: 56px;
  font-weight: 800;
}

.step-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 14px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 12px -4px 0;
}

.option-grid.gender {
  gap: 12px;
  margin: 12px -6px 0;
}

.option-grid.position {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.option-grid.scrollable-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1.6vh, 12px);
  margin: 4px -4px 0;
  overflow: visible;
}

.scrollable-options .option-card {
  height: clamp(132px, calc((100dvh - 252px) / 3), 186px);
  min-height: 0;
}

.scrollable-options .portrait {
  height: 100%;
  aspect-ratio: auto;
}

.scrollable-options .option-name {
  font-size: clamp(17px, 4.4vw, 20px);
}

.scrollable-options .option-meta {
  font-size: clamp(11px, 3.1vw, 13px);
}

.option-card {
  border: 1px solid rgba(21, 21, 24, 0.1);
  background: #fff;
  border-radius: 12px;
  padding: 0;
  min-height: 184px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(21, 21, 24, 0.08);
  text-align: left;
}

.scrollable-options .option-card {
  min-height: 0;
}

.option-card.gender {
  min-height: 228px;
  border-radius: 14px;
}

.option-card.selected {
  border: 2px solid var(--violet);
  box-shadow: 0 0 0 3px rgba(95, 91, 232, 0.12), 0 10px 22px rgba(95, 91, 232, 0.18);
}

.portrait {
  width: 100%;
  aspect-ratio: 1.08;
  display: block;
  object-fit: cover;
  filter: saturate(0.97);
}

.option-card.gender .portrait {
  height: 100%;
  min-height: 228px;
  aspect-ratio: auto;
  object-position: center;
}

.option-copy {
  position: absolute;
  inset: auto 0 0;
  min-height: 70px;
  padding: 34px 12px 13px;
  color: #fff;
  background: linear-gradient(180deg, transparent 0%, rgba(8, 10, 18, 0.42) 34%, rgba(8, 10, 18, 0.88) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.option-card.gender .option-copy {
  min-height: 82px;
  padding: 48px 16px 18px;
  background: linear-gradient(180deg, transparent 0%, rgba(8, 10, 18, 0.42) 30%, rgba(8, 10, 18, 0.9) 100%);
}

.option-name {
  font-size: clamp(17px, 4.4vw, 20px);
  font-weight: 800;
  line-height: 1.2;
}

.option-card.gender .option-name {
  font-size: 18px;
}

.option-meta {
  margin-top: 5px;
  font-size: clamp(11px, 3.1vw, 13px);
  color: rgba(255, 255, 255, 0.82);
}

.option-card.gender .option-meta {
  font-size: 15px;
}

.check-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--violet);
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  transform: scale(0.84);
  box-shadow: 0 6px 14px rgba(95, 91, 232, 0.28);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 2;
}

.option-card.selected .check-badge {
  opacity: 1;
  transform: scale(1);
}

.footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 0;
  flex: 0 0 auto;
  margin-top: 6px;
  padding: 0 2px 8px;
  background: #ffffff;
}

.circle-button {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--violet);
  box-shadow: 0 4px 12px rgba(95, 91, 232, 0.18);
}

.circle-button.back {
  background: #eeeef1;
  color: #9d9aa5;
  box-shadow: none;
}

.circle-button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(95, 91, 232, 0.2);
}

.dot.active {
  width: 30px;
  background: var(--violet);
}

.loading-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 28px;
}

.loading-visual {
  width: min(68vw, 250px);
  aspect-ratio: 1;
  background: #dedede;
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.loading-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.75;
  animation: pulseImage 1.2s ease-in-out infinite;
}

.spinner-line {
  width: 204px;
  height: 6px;
  border-radius: 999px;
  background: #ece8df;
  overflow: hidden;
}

.spinner-line::after {
  content: "";
  display: block;
  width: 44%;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  animation: slide 1.1s ease-in-out infinite;
}

.candidate-list {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.candidate-card {
  width: 100%;
  min-height: 112px;
  border: 1px solid #f1d89c;
  border-radius: 12px;
  background: #fff;
  padding: 18px 18px;
  text-align: center;
  transition:
    background 160ms ease,
    border 160ms ease,
    transform 160ms ease;
}

.candidate-card:hover,
.candidate-card:focus-visible {
  outline: 0;
  transform: translateY(-1px);
}

.candidate-card.selected {
  background: var(--gold);
  border-color: var(--gold);
}

.candidate-name {
  font-size: 18px;
  color: #e9a400;
  font-weight: 900;
}

.candidate-card.selected .candidate-name {
  color: #6b4700;
}

.candidate-meaning {
  display: block;
  margin-top: 10px;
  color: #4b4652;
  font-size: 14px;
  line-height: 1.5;
}

.result-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 22px;
  padding-top: 10px;
}

.result-kicker {
  margin: 2px 0 0;
  color: #8a8490;
  font-size: 14px;
  font-weight: 800;
}

.result-name {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 900;
}

.result-name small {
  display: block;
  margin-top: 8px;
  font-size: 15px;
  color: var(--muted);
}

.result-card {
  width: min(100%, 316px);
  border-radius: 14px;
  background: linear-gradient(180deg, #efe6ff 0%, #9f98f4 100%);
  padding: 24px;
  color: #fff;
  box-shadow: 0 24px 42px rgba(95, 91, 232, 0.18);
}

.result-card img {
  width: 190px;
  aspect-ratio: 1;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  margin: 0 auto 18px;
}

.result-quote {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 5px rgba(43, 35, 86, 0.48);
}

.action-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: auto;
}

.modal-backdrop,
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 24, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  z-index: 20;
}

.modal {
  width: 100%;
  max-width: 342px;
  border-radius: 16px;
  background: #fff;
  padding: 26px 20px 18px;
  text-align: center;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.22);
}

.modal h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
}

.modal p {
  margin: 12px 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-actions button {
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
}

.cancel-button {
  background: #f2f0f6;
  color: #77727d;
}

.login-button {
  background: var(--violet);
  color: #fff;
}

.sheet-backdrop {
  align-items: flex-end;
  justify-content: stretch;
  padding: 0;
}

.share-sheet {
  width: 100%;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 22px 22px 30px;
  box-shadow: 0 -18px 45px rgba(0, 0, 0, 0.2);
}

.sheet-title {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 900;
}

.share-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.share-option {
  border: 0;
  background: transparent;
  color: #3d3944;
  display: grid;
  justify-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
}

.share-icon {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: #f4f2f7;
  display: grid;
  place-items: center;
  color: var(--violet);
}

.toast {
  position: absolute;
  left: 26px;
  right: 26px;
  bottom: 22px;
  z-index: 30;
  background: #151518;
  color: #fff;
  border-radius: 10px;
  padding: 16px 18px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  animation: toastIn 220ms ease both;
}

@keyframes pulseImage {
  0%,
  100% {
    transform: scale(1);
    filter: saturate(0.88);
  }
  50% {
    transform: scale(1.035);
    filter: saturate(1.08);
  }
}

@keyframes slide {
  0% {
    transform: translateX(-105%);
  }
  100% {
    transform: translateX(235%);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 520px) {
  html,
  body,
  #root {
    width: 100%;
    height: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    background: var(--paper);
    overflow: hidden;
  }

  body {
    position: fixed;
    inset: 0;
    overscroll-behavior: none;
  }

  .page {
    display: contents;
  }

  #app.phone-shell {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: none;
    min-height: 100dvh;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .app-header {
    height: 74px;
    padding: 18px 26px 12px;
  }

  .screen {
    padding-inline: 26px;
  }
}

@media (max-width: 360px) {
  .app-header {
    padding-inline: 20px;
  }

  .screen {
    padding-inline: 20px;
  }

  .option-grid {
    gap: 12px;
  }

  .option-card {
    min-height: 164px;
  }

  .option-card.gender,
  .option-card.gender .portrait {
    min-height: 204px;
  }

  .question {
    font-size: 20px;
  }

  .subcopy {
    font-size: 13px;
  }
}
