:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: rgba(255, 255, 255, 0.62);
  --surface-soft: rgba(255, 245, 248, 0.72);
  --ink: #111315;
  --muted: #727780;
  --line: rgba(255, 255, 255, 0.78);
  --primary: #ff8ab6;
  --primary-strong: #f15d86;
  --accent: #ffb16d;
  --sky: #cfe7f4;
  --violet: #d9c8f4;
  --shadow: 0 24px 70px rgba(47, 37, 43, 0.12);
  --screen-pad: 20px;
  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 14px;
  --space-lg: 20px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --touch-min: 48px;
  font-family:
    Pretendard,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  background: var(--bg);
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 4%, rgba(224, 228, 235, 0.95), transparent 28rem),
    linear-gradient(180deg, #fbfbfc 0%, #f3f4f6 48%, #eceef2 100%),
    var(--bg);
  overflow-x: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body::before,
body::after {
  position: fixed;
  inset: auto;
  z-index: -1;
  display: block;
  pointer-events: none;
  content: "";
  filter: blur(34px);
  opacity: 0.86;
}

body::before {
  top: -6rem;
  right: -8rem;
  width: 34rem;
  height: 26rem;
  background: linear-gradient(135deg, rgba(255, 117, 151, 0.72), rgba(255, 176, 91, 0.42), rgba(207, 231, 244, 0.62));
  transform: rotate(-9deg);
}

body::after {
  bottom: -8rem;
  left: -9rem;
  width: 32rem;
  height: 28rem;
  background: linear-gradient(135deg, rgba(218, 200, 244, 0.58), rgba(255, 201, 216, 0.62), rgba(255, 255, 255, 0));
  transform: rotate(12deg);
}

button,
input {
  font: inherit;
  touch-action: manipulation;
}

button {
  border: 0;
}

button:not(:disabled) {
  transition:
    transform 0.14s cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 0.14s ease,
    box-shadow 0.14s ease,
    background-color 0.14s ease,
    border-color 0.14s ease,
    opacity 0.14s ease;
  will-change: transform;
}

button:not(:disabled):hover {
  filter: brightness(1.02) saturate(1.04);
}

button:focus-visible {
  outline: 3px solid rgba(45, 129, 255, 0.38);
  outline-offset: 3px;
}

button:not(:disabled):active {
  transform: translateY(2px) scale(0.96);
  filter: brightness(0.92) saturate(0.98);
}

button.is-pressing:not(:disabled) {
  transform: translateY(2px) scale(0.96);
  filter: brightness(0.92) saturate(0.98);
}

.top-bar {
  position: relative;
  z-index: 5;
  display: grid;
  align-items: center;
  gap: 0.75rem;
  width: min(420px, calc(100% - 1.25rem));
  margin: 0.7rem auto 0;
  padding: calc(env(safe-area-inset-top) + 0.55rem) 1.25rem 0.65rem;
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-bottom: 0;
  border-radius: 2rem 2rem 0 0;
  backdrop-filter: blur(28px);
  box-shadow: 0 16px 50px rgba(42, 35, 39, 0.07);
}

.mobile-status {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(37, 25, 33, 0.68);
  font-size: 0.75rem;
  font-weight: 700;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  color: rgba(24, 19, 21, 0.82);
  font-size: 0.88rem;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 1.95rem;
  height: 1.95rem;
  place-items: center;
  color: #fff;
  background: #171214;
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(24, 19, 21, 0.16);
}

.page {
  position: relative;
  width: min(420px, calc(100% - 1.25rem));
  margin: 0 auto;
  min-height: calc(100svh - 5.5rem);
  padding: 0 1.25rem calc(env(safe-area-inset-bottom) + 1rem);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(255, 250, 251, 0.68)),
    var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-top: 0;
  border-radius: 0 0 2rem 2rem;
  box-shadow: 0 30px 80px rgba(61, 48, 58, 0.1);
  overflow: hidden;
}

.page::before {
  position: absolute;
  top: 3.1rem;
  right: -5.6rem;
  width: 16rem;
  height: 21rem;
  background: linear-gradient(160deg, rgba(255, 136, 174, 0.74), rgba(255, 185, 100, 0.44), rgba(214, 234, 244, 0.34));
  border-radius: 5rem;
  content: "";
  filter: blur(26px);
  opacity: 0.72;
  transform: rotate(24deg);
}

.home-shell {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1.05rem;
}

.hero {
  display: grid;
  gap: 0.55rem;
  align-items: end;
  padding: 1.15rem 0 0;
}

.compact-hero {
  display: grid;
  max-width: none;
  padding-bottom: 0;
}

.hero-copy {
  display: grid;
  gap: 0.82rem;
  padding: 0 0.1rem;
}

.eyebrow {
  width: fit-content;
  margin: 0;
  padding: 0.42rem 0.72rem;
  color: rgba(24, 19, 21, 0.72);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  backdrop-filter: blur(18px);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 11ch;
  font-size: clamp(2.35rem, 11vw, 3.35rem);
  line-height: 1.04;
  letter-spacing: 0;
  font-weight: 800;
  text-wrap: balance;
}

.lead {
  max-width: 19rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.58;
}

.sublead {
  max-width: 22rem;
  color: rgba(24, 19, 21, 0.58);
  font-size: 0.88rem;
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.button {
  display: inline-flex;
  min-height: var(--touch-min);
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  font-weight: 800;
  backdrop-filter: blur(18px);
}

.button:active {
  transform: translateY(1px) scale(0.965);
}

.button.primary {
  color: #fff;
  background: #151113;
  border-color: #151113;
  box-shadow: 0 18px 42px rgba(24, 19, 21, 0.2);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  box-shadow: none;
}

.button.loading {
  opacity: 1;
}

.button.is-busy {
  opacity: 1;
  pointer-events: none;
  filter: saturate(0.9);
  position: relative;
  color: rgba(255, 255, 255, 0.88);
}

.button.is-busy::before {
  width: 0.95rem;
  height: 0.95rem;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-top-color: #fff;
  border-radius: 999px;
  animation: spin 0.82s linear infinite;
  content: "";
}

.button-spinner,
.loading-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-top-color: #fff;
  border-radius: 999px;
  animation: spin 0.82s linear infinite;
}

.phone-preview {
  position: relative;
  min-height: 34rem;
  padding: 1rem;
  border: 1px solid rgba(234, 213, 221, 0.9);
  border-radius: 2.1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.96)),
    radial-gradient(circle at 80% 12%, rgba(32, 183, 166, 0.18), transparent 15rem);
  box-shadow: var(--shadow);
}

.phone-screen {
  min-height: 32rem;
  padding: 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.45rem;
  background: #fff;
}

.model-hand {
  position: relative;
  min-height: 22rem;
  overflow: hidden;
  border-radius: 1rem;
  background:
    linear-gradient(140deg, rgba(255, 232, 224, 0.75), rgba(255, 246, 239, 0.88)),
    #fff3ec;
}

.palm {
  position: absolute;
  right: 14%;
  bottom: -18%;
  width: 54%;
  aspect-ratio: 0.82;
  background: linear-gradient(145deg, #ffe2d1, #f8bfa8);
  border-radius: 48% 46% 42% 44%;
  box-shadow: inset -14px -18px 40px rgba(157, 83, 67, 0.14);
}

.finger {
  position: absolute;
  bottom: 38%;
  width: 13%;
  height: 50%;
  background: linear-gradient(180deg, #ffe2d1, #f8bea8);
  border-radius: 999px;
  transform-origin: bottom center;
}

.finger:nth-child(2) {
  left: 22%;
  height: 42%;
  transform: rotate(-18deg);
}

.finger:nth-child(3) {
  left: 36%;
  height: 58%;
  transform: rotate(-8deg);
}

.finger:nth-child(4) {
  left: 50%;
  height: 62%;
  transform: rotate(2deg);
}

.finger:nth-child(5) {
  left: 64%;
  height: 54%;
  transform: rotate(12deg);
}

.finger:nth-child(6) {
  left: 76%;
  height: 42%;
  transform: rotate(23deg);
}

.nail {
  position: absolute;
  top: 0.42rem;
  left: 50%;
  width: 58%;
  height: 22%;
  transform: translateX(-50%);
  border-radius: 50% 50% 45% 45%;
  background:
    radial-gradient(circle at 34% 32%, rgba(255, 255, 255, 0.9), transparent 0.45rem),
    linear-gradient(160deg, #74d0d9, #d7fbff 48%, #3b9aaa);
  box-shadow: inset 0 -4px 7px rgba(24, 95, 107, 0.2);
}

.result-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.mini-result {
  min-height: 6rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--surface-soft);
}

.mini-result strong {
  display: block;
  margin-bottom: 0.35rem;
}

.mini-result span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.upload-panel {
  display: grid;
  gap: 0.82rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.hero-upload-panel {
  max-width: none;
}

.upload-intro {
  display: grid;
  gap: 0.9rem;
  padding-bottom: 0.5rem;
}

.upload-intro h1 {
  max-width: 12ch;
  font-size: clamp(2.4rem, 8vw, 5.4rem);
}

.simplified-head {
  margin-bottom: 0;
}

.quick-flow {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  align-items: stretch;
}

.single-flow {
  grid-template-columns: 1fr;
}

.single-flow .button {
  width: 100%;
}

.primary-upload-slot {
  display: grid;
}

.primary-upload-slot .upload-slot {
  min-height: 14.8rem;
}

.hero-upload-panel .primary-upload-slot .upload-slot {
  min-height: 14.8rem;
}

.upload-slot {
  position: relative;
  display: grid;
  min-height: 10rem;
  place-items: center;
  overflow: hidden;
  padding: 1.2rem;
  color: var(--muted);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 1.65rem;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 244, 248, 0.62) 48%, rgba(228, 239, 245, 0.58) 100%),
    var(--surface-soft);
  box-shadow: 0 22px 58px rgba(45, 36, 42, 0.11);
  backdrop-filter: blur(24px);
  cursor: pointer;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease,
    background 180ms ease;
}

.upload-slot::before {
  display: grid;
  width: 3.4rem;
  height: 3.4rem;
  margin-bottom: 0.56rem;
  place-items: center;
  color: rgba(24, 19, 21, 0.86);
  content: "+";
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  font-size: 1.7rem;
  font-weight: 500;
  box-shadow: 0 14px 34px rgba(24, 19, 21, 0.1);
  backdrop-filter: blur(18px);
}

.upload-slot input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.slot-content {
  display: grid;
  gap: 0.42rem;
  justify-items: center;
}

.slot-badge {
  display: grid;
  width: 1.9rem;
  height: 1.9rem;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 900;
}

.slot-content b {
  color: var(--ink);
  font-size: 1.05rem;
}

.slot-content small {
  color: var(--muted);
  line-height: 1.4;
}

.slot-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slot-preview + .slot-content {
  position: absolute;
  right: 0.65rem;
  bottom: 0.65rem;
  left: 0.65rem;
  padding: 0.72rem;
  color: #fff;
  background: rgba(24, 19, 21, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 1.1rem;
  backdrop-filter: blur(14px);
}

.slot-preview + .slot-content b,
.slot-preview + .slot-content small {
  color: #fff;
}

.generation-panel {
  display: grid;
  gap: 0.7rem;
  padding: 0.95rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 1.35rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.66), rgba(255, 237, 222, 0.56), rgba(228, 239, 245, 0.52)),
    rgba(255, 255, 255, 0.58);
  box-shadow: 0 16px 42px rgba(61, 44, 55, 0.08);
  backdrop-filter: blur(24px);
}

.generation-panel.hidden {
  display: none;
}

.generation-panel-head {
  display: flex;
  align-items: center;
  gap: 0.62rem;
}

.generation-panel-head strong {
  font-size: 0.95rem;
}

.generation-panel .loading-spinner {
  flex: 0 0 auto;
  border-color: rgba(232, 79, 130, 0.24);
  border-top-color: var(--primary-strong);
}

.generation-panel p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.generation-progress {
  height: 0.44rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(33, 22, 29, 0.08);
}

.generation-progress span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--sky));
  animation: progressSweep 1.7s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes progressSweep {
  0% {
    transform: translateX(-115%);
  }

  100% {
    transform: translateX(250%);
  }
}

.workflow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.workflow-step {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.7);
}

.workflow-step span {
  display: grid;
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.7rem;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border-radius: 0.6rem;
  font-weight: 900;
}

.workflow-step h3 {
  margin-bottom: 0.35rem;
  font-size: 1rem;
}

.workflow-step p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: calc(env(safe-area-inset-bottom) + 1rem);
  left: 1rem;
  z-index: 1000;
  width: min(28rem, calc(100% - 2rem));
  margin-left: auto;
  padding: 0.9rem 1rem;
  color: #fff;
  background: rgba(24, 19, 21, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 1.1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.result-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 1rem;
  background: rgba(24, 19, 21, 0.32);
  backdrop-filter: blur(22px);
}

.result-modal {
  position: relative;
  display: grid;
  gap: 1rem;
  width: min(430px, 100%);
  max-height: calc(100svh - 2rem);
  overflow: auto;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 1.8rem;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(255, 244, 248, 0.88), rgba(233, 241, 246, 0.86)),
    #fff;
  box-shadow: 0 28px 80px rgba(24, 19, 21, 0.22);
  backdrop-filter: blur(28px);
}

.result-modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.result-modal h2 {
  margin-top: 0.35rem;
  font-size: 1.7rem;
  line-height: 1;
}

.icon-button {
  display: grid;
  width: 2.7rem;
  height: 2.7rem;
  flex: 0 0 auto;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.65rem;
  font-weight: 500;
  line-height: 1;
  backdrop-filter: blur(16px);
}

.result-image {
  display: block;
  width: 100%;
  max-height: 58svh;
  object-fit: contain;
  border-radius: 1.05rem;
  background: #fff;
  box-shadow: 0 14px 36px rgba(24, 19, 21, 0.08);
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.72rem;
}

@media (max-width: 860px) {
  .top-bar {
    width: min(430px, calc(100% - 1rem));
  }

  .quick-flow {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .top-bar,
  .page {
    width: 100%;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .top-bar {
    margin-top: 0;
  }

  .page {
    padding-inline: 0.9rem;
  }

  .upload-slot {
    min-height: 12rem;
  }
}

/* Figma MVP flow */
body {
  display: grid;
  min-height: 100svh;
  place-items: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 151, 181, 0.18), transparent 20rem),
    #f4f0ee;
}

.app-shell {
  width: min(390px, 100vw);
  min-height: min(844px, 100svh);
}

.app-screen {
  position: relative;
  width: min(390px, 100vw);
  min-height: min(844px, 100svh);
  margin: 0 auto;
  overflow: hidden;
  color: #181315;
  background:
    radial-gradient(circle at 86% 4%, rgba(224, 228, 235, 0.86), transparent 18rem),
    linear-gradient(180deg, #fcfcfd 0%, #f1f2f4 100%);
  box-shadow: 0 32px 90px rgba(32, 24, 28, 0.14);
}

.app-screen > * {
  position: relative;
  z-index: 1;
}

.top-nav {
  position: relative;
  z-index: 3;
  display: flex;
  height: calc(env(safe-area-inset-top) + 58px);
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top) var(--screen-pad) 0;
}

.top-nav-title {
  font-size: 15px;
  font-weight: 950;
}

.nav-icon,
.nav-icon-button,
.nav-spacer {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
}

.nav-icon,
.nav-icon-button {
  color: #181315;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.nav-action-group {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.generation-availability-badge {
  display: inline-flex;
  width: auto;
  max-width: 176px;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  color: #181315;
  border: 1px solid rgba(24, 19, 21, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 10px 28px rgba(24, 19, 21, 0.08);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.generation-availability-badge.has-free {
  color: #472d1f;
  border-color: rgba(196, 117, 61, 0.2);
  background: rgba(255, 246, 235, 0.84);
}

.generation-availability-badge.is-empty {
  color: rgba(24, 19, 21, 0.66);
}

.generation-availability-label {
  color: rgba(24, 19, 21, 0.58);
  font-weight: 800;
}

.generation-availability-badge strong {
  font-size: 13px;
  font-weight: 950;
}

.welcome-main-screen > .top-nav {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

.main-screen {
  display: flex;
  overflow-y: auto;
  flex-direction: column;
  background:
    radial-gradient(circle at 80% 5%, rgba(224, 228, 235, 0.9), transparent 18rem),
    linear-gradient(180deg, #fcfcfd 0%, #f1f2f4 100%);
}

.main-screen::before {
  display: none;
}

.welcome-main-screen {
  align-items: center;
  padding: 0;
}

.main-welcome-card {
  display: grid;
  width: 100%;
  min-height: 100svh;
  overflow: hidden;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.main-photo-panel {
  height: min(43svh, 390px);
  min-height: 318px;
  overflow: hidden;
  background: #eef0f2;
}

.main-hero {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 22px;
  padding: 12px var(--screen-pad) 0;
}

.main-hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 58%;
  border-radius: 0;
}

.nail-hero-image {
  box-shadow: none;
}

.main-bottom-panel {
  position: relative;
  z-index: 1;
  display: grid;
  margin-top: -42px;
  padding: 54px var(--screen-pad) calc(env(safe-area-inset-bottom) + 24px);
  border-radius: 48% 48% 0 0 / 8% 8% 0 0;
  background: #fff;
  text-align: center;
}

.main-hero-visual {
  display: grid;
  width: min(326px, 92vw);
  min-height: 264px;
  justify-self: center;
  align-items: end;
  padding: 28px 22px;
  border-radius: 32px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(245, 247, 250, 0.72)),
    radial-gradient(circle at 76% 18%, rgba(255, 221, 231, 0.66), transparent 9rem);
  box-shadow: 0 22px 62px rgba(17, 19, 21, 0.12);
}

.main-hand-card {
  display: flex;
  min-height: 156px;
  align-items: end;
  justify-content: center;
  gap: 10px;
  padding: 22px 14px 18px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(17, 19, 21, 0.05);
}

.main-nail-tip {
  position: relative;
  display: block;
  width: 42px;
  height: 72px;
  border-radius: 23px 23px 18px 18px;
  background:
    radial-gradient(circle at 62% 24%, rgba(255, 255, 255, 0.92) 0 4px, transparent 5px),
    linear-gradient(180deg, #ffe6ec 0%, #f8cbd6 55%, #bcdff4 100%);
  box-shadow: inset 0 0 0 1px rgba(17, 19, 21, 0.07), 0 12px 24px rgba(17, 19, 21, 0.08);
}

.main-nail-tip::after {
  position: absolute;
  right: 10px;
  bottom: 12px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  content: '';
}

.main-nail-tip.tip-1,
.main-nail-tip.tip-5 {
  height: 58px;
  transform: translateY(9px);
}

.main-nail-tip.tip-2,
.main-nail-tip.tip-4 {
  height: 68px;
  transform: translateY(3px);
}

.main-nail-tip.tip-3 {
  height: 78px;
  background:
    radial-gradient(circle at 62% 22%, rgba(255, 255, 255, 0.92) 0 4px, transparent 5px),
    linear-gradient(180deg, #f8dce5 0%, #eef5ff 50%, #b8def5 100%);
}

.main-copy {
  display: grid;
  gap: 10px;
  margin-top: 0;
  padding: 0 2px;
  justify-items: center;
}

.main-copy h1,
.result-title-stack h1 {
  max-width: none;
  color: #111315;
  font-size: 29px;
  font-weight: 950;
  line-height: 1.08;
  white-space: pre-line;
}

.main-copy p {
  max-width: 286px;
  color: #727780;
  font-size: 13px;
  line-height: 1.54;
  font-weight: 560;
}

.main-eyebrow {
  display: inline-flex;
  width: fit-content;
  min-height: 32px;
  align-items: center;
  padding: 0 11px;
  border: 1px solid rgba(17, 19, 21, 0.09);
  border-radius: 999px;
  color: #4d535c;
  background: rgba(255, 255, 255, 0.66);
  font-size: 12px;
  font-weight: 850;
  backdrop-filter: blur(18px);
}

.main-trust-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding-top: 4px;
}

.main-trust-chip {
  padding: 6px 9px;
  border: 0;
  border-radius: 999px;
  color: #686f78;
  background: rgba(17, 19, 21, 0.055);
  font-size: 11px;
  font-weight: 850;
}

.main-upload-guide-list {
  display: grid;
  gap: 4px;
  width: min(286px, 100%);
  margin: 0 auto;
  padding-top: 4px;
  color: #6d747d;
  font-size: 11.5px;
  font-weight: 760;
  line-height: 1.36;
  text-align: left;
}

.main-upload-guide-list span {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.main-upload-guide-list span::before {
  flex: 0 0 auto;
  width: 4px;
  height: 4px;
  margin-top: 6px;
  border-radius: 999px;
  background: rgba(17, 19, 21, 0.38);
  content: '';
}

.main-cta {
  position: absolute;
  right: 23px;
  bottom: calc(env(safe-area-inset-bottom) + 130px);
  left: 23px;
  z-index: 2;
  min-height: 54px;
  border-radius: 12px;
  font-size: 15px;
}

.main-action-stack {
  position: relative;
  margin: 22px 0 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.main-action-stack.is-single {
  grid-template-columns: 1fr;
}

.main-action {
  min-height: 48px;
  border-radius: 999px;
  font-size: 15px;
}

.main-action.secondary {
  border: 1px solid rgba(17, 19, 21, 0.16);
}

.history-entry-action {
  color: rgba(24, 19, 21, 0.76);
  background: rgba(255, 255, 255, 0.78);
}

.main-policy-links {
  position: relative;
  margin: 22px 0 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 14px;
  font-size: 11px;
  font-weight: 800;
}

.main-policy-links a {
  color: rgba(24, 19, 21, 0.54);
  text-decoration: none;
}

@media (max-height: 740px) {
  .welcome-main-screen {
    padding-top: 0;
  }

  .main-photo-panel {
    height: 276px;
    min-height: 252px;
  }

  .main-bottom-panel {
    margin-top: -34px;
    padding: 42px var(--screen-pad) calc(env(safe-area-inset-bottom) + 20px);
  }

  .main-hero {
    gap: 16px;
    padding-top: 6px;
  }

  .main-hero-visual {
    min-height: 206px;
    padding: 22px 18px;
  }

  .main-hand-card {
    min-height: 120px;
    gap: 8px;
  }

  .main-nail-tip {
    width: 34px;
    height: 60px;
  }

  .main-nail-tip.tip-1,
  .main-nail-tip.tip-5 {
    height: 49px;
  }

  .main-nail-tip.tip-2,
  .main-nail-tip.tip-4 {
    height: 56px;
  }

  .main-nail-tip.tip-3 {
    height: 64px;
  }

  .main-copy {
    gap: 8px;
  }

  .main-copy h1 {
    font-size: 25px;
  }

  .main-copy p {
    font-size: 12.5px;
    line-height: 1.46;
  }

  .main-upload-guide-list {
    gap: 3px;
    font-size: 11px;
    line-height: 1.3;
  }

  .main-action-stack {
    margin-top: 18px;
    gap: 10px;
  }

  .main-policy-links {
    margin-top: 18px;
  }
}

.visually-hidden-file {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.preview-screen,
.result-screen,
.history-screen {
  overflow-y: auto;
  background:
    radial-gradient(circle at 80% 4%, rgba(224, 228, 235, 0.92), transparent 17rem),
    linear-gradient(180deg, #fcfcfd 0%, #f1f2f4 100%);
}

.preview-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  padding: 12px var(--screen-pad) max(28px, env(safe-area-inset-bottom));
}

.history-content {
  display: grid;
  gap: 18px;
  padding: 12px var(--screen-pad) max(28px, env(safe-area-inset-bottom));
}

.history-title-stack {
  display: grid;
  gap: 9px;
}

.history-title-stack h1 {
  color: #111315;
  font-size: 34px;
  font-weight: 950;
  line-height: 1.02;
}

.history-title-stack p {
  max-width: 320px;
  color: #727780;
  font-size: 13px;
  font-weight: 560;
  line-height: 1.5;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  min-height: 112px;
  padding: 10px;
  color: #181315;
  border: 1px solid rgba(17, 19, 21, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 38px rgba(17, 19, 21, 0.08);
  text-align: left;
}

.history-thumb-wrap {
  display: block;
  width: 92px;
  height: 92px;
  overflow: hidden;
  border-radius: 14px;
  background: #eef0f2;
}

.history-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-card-copy {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.history-card-copy strong {
  overflow-wrap: anywhere;
  color: #111315;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.25;
}

.history-card-copy span {
  color: #727780;
  font-size: 12px;
  font-weight: 800;
}

.history-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 22px;
  color: #727780;
  border: 1px solid rgba(17, 19, 21, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.history-state .loading-spinner {
  border-color: rgba(232, 79, 130, 0.24);
  border-top-color: var(--primary-strong);
}

.history-state strong {
  color: #111315;
  font-size: 17px;
  font-weight: 900;
}

.history-state p {
  max-width: 260px;
  font-size: 13px;
  font-weight: 560;
  line-height: 1.45;
}

.history-start-action {
  min-width: 168px;
  margin-top: 4px;
}

.preview-title-stack {
  display: grid;
  gap: 12px;
  padding: 4px 2px 0;
}

.preview-title-stack h1 {
  color: #111315;
  font-size: 40px;
  font-weight: 950;
  line-height: 0.98;
  letter-spacing: 0;
  white-space: pre-line;
}

.preview-title-stack p {
  max-width: 330px;
  color: #727780;
  font-size: 14px;
  line-height: 1.54;
  font-weight: 560;
}

.free-usage-notice {
  margin-top: -36px;
  padding: 11px 12px;
  color: #56341f;
  border: 1px solid rgba(196, 117, 61, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(255, 246, 235, 0.86);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
}

.free-usage-notice.used {
  color: rgba(24, 19, 21, 0.62);
  border-color: rgba(24, 19, 21, 0.1);
  background: rgba(255, 255, 255, 0.78);
}

.preview-media-slot {
  display: grid;
}

.preview-upload-slot {
  min-height: 294px;
  border-radius: 30px;
  border: 1px dashed rgba(17, 19, 21, 0.14);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 18px 48px rgba(17, 19, 21, 0.08);
  cursor: default;
}

.preview-upload-slot::before {
  display: none;
}

.preview-upload-slot input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.preview-upload-slot .slot-content {
  gap: 10px;
}

.preview-upload-slot .slot-content b {
  color: #111315;
  font-size: 17px;
  font-weight: 780;
}

.upload-guide {
  display: grid;
  gap: 4px;
  max-width: 272px;
  color: #746d72;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.upload-plus {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 4px;
  place-items: center;
  color: #151113;
  border: 1px solid #e1dce0;
  border-radius: 999px;
  background: #fff;
  font-size: 36px;
  font-weight: 300;
  line-height: 1;
}

.upload-choice-stack {
  display: grid;
  gap: var(--space-sm);
  width: min(240px, 100%);
  margin-top: 18px;
}

.upload-choice-button {
  min-height: var(--touch-min);
  padding: 10px 18px;
  color: #fff;
  border: 0;
  border-radius: 17px;
  background: #111315;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  line-height: 22px;
  box-shadow: 0 10px 20px rgba(24, 19, 21, 0.12);
  transition:
    transform 0.14s cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 0.14s ease,
    box-shadow 0.14s ease,
    background-color 0.14s ease;
}

.upload-choice-button:not(:disabled):hover,
.image-action-button:not(:disabled):hover {
  filter: brightness(1.03);
}

.upload-choice-button:active {
  box-shadow: 0 4px 10px rgba(24, 19, 21, 0.14);
}

.upload-choice-button.is-pressing {
  transform: translateY(2px) scale(0.97);
  box-shadow: 0 4px 10px rgba(24, 19, 21, 0.14);
  filter: brightness(0.92);
}

.selected-image-card {
  display: grid;
  gap: var(--space-sm);
  width: 100%;
}

.selected-image-preview {
  height: 320px;
  overflow: hidden;
  border-radius: 30px;
  background: #e9ebee;
  box-shadow: 0 18px 48px rgba(17, 19, 21, 0.1);
}

.selected-image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.selected-image-card input {
  display: none;
}

.image-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
}

.image-action-button {
  min-height: var(--touch-min);
  color: #151113;
  border: 1px solid rgba(24, 19, 21, 0.12);
  border-radius: 17px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(24, 19, 21, 0.06);
  transition:
    transform 0.14s cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 0.14s ease,
    box-shadow 0.14s ease,
    border-color 0.14s ease;
}

.image-action-button:active {
  box-shadow: 0 3px 8px rgba(24, 19, 21, 0.08);
}

.image-action-button.is-pressing {
  transform: translateY(2px) scale(0.97);
  box-shadow: 0 3px 8px rgba(24, 19, 21, 0.08);
  filter: brightness(0.94);
}

.image-action-button.danger {
  color: #d9416a;
  background: #fff7fa;
  border-color: rgba(217, 65, 106, 0.2);
}

.cta-button {
  min-height: 60px;
  border-radius: 19px;
  font-size: 16px;
}

.generation-action-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
}

.generation-action-stack .cta-button {
  grid-column: 1 / -1;
  min-height: 56px;
  padding-right: 8px;
  padding-left: 8px;
  white-space: normal;
}

.generation-limit-note {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  color: #747a83;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
}

.generating-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 19, 21, 0.34);
  backdrop-filter: blur(16px);
}

.generating-overlay.hidden {
  display: none;
}

.generating-card {
  display: grid;
  width: 100%;
  gap: 14px;
  justify-items: center;
  padding: 28px 20px;
  text-align: center;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 80px rgba(17, 19, 21, 0.22);
}

.generating-card strong {
  font-size: 17px;
}

.generating-card p {
  color: var(--muted);
  font-size: 13px;
}

.result-content {
  display: grid;
  gap: 16px;
  padding: 14px var(--screen-pad) max(24px, env(safe-area-inset-bottom));
}

.result-title-stack {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding-top: 4px;
  text-align: center;
}

.result-title-stack h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.18;
}

.result-title-stack p {
  max-width: 100%;
  margin: 0;
  color: rgba(24, 19, 21, 0.58);
  font-size: 13px;
  line-height: 1.45;
  white-space: nowrap;
}

.result-photo {
  width: 100%;
  aspect-ratio: 1;
  margin-top: 4px;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: #f2eeee;
  box-shadow: 0 16px 46px rgba(44, 34, 39, 0.1);
}

.result-primary-row,
.result-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.result-action-row {
  margin-top: -4px;
}

.result-save-notice {
  margin: -8px 2px 0;
  padding: 8px 10px;
  color: #68707b;
  border-radius: 999px;
  background: rgba(17, 19, 21, 0.045);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
  text-align: center;
}

.result-primary-row .button,
.result-action-row .button {
  min-height: 58px;
  border-radius: var(--radius-md);
  font-size: 15px;
}

.result-primary-row .secondary,
.result-action-row .secondary {
  color: rgba(24, 19, 21, 0.76);
  border-color: rgba(24, 19, 21, 0.08);
  background: rgba(255, 255, 255, 0.82);
}

.share-action,
.download-action,
.regenerate-action,
.new-image-action {
  width: 100%;
}

@media (max-width: 520px) {
  body {
    display: block;
    background: #fff;
  }

  .app-shell,
  .app-screen {
    width: 100vw;
    min-height: 100svh;
    box-shadow: none;
  }

  .main-cta {
    bottom: calc(env(safe-area-inset-bottom) + 80px);
  }

  .main-action-stack {
    margin-top: 30px;
  }
}
