:root {
  color-scheme: light;
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --ink: #251f3d;
  --muted: #6f6a7e;
  --primary: #6b4eff;
  --primary-dark: #4c32d5;
  --lavender: #eeeaff;
  --peach: #ffddc8;
  --cream: #fff9f2;
  --line: #e9e5ef;
  --card: #ffffff;
  --shadow: 0 18px 50px rgba(71, 50, 113, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: #eeeaf4;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 4px solid rgba(107, 78, 255, 0.25);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  position: relative;
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  background: #fbf9fd;
  box-shadow: 0 0 70px rgba(40, 25, 68, 0.12);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: max(14px, env(safe-area-inset-top)) 22px 12px;
  background: rgba(251, 249, 253, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
  text-decoration: none;
  letter-spacing: -0.04em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  transform: rotate(-7deg);
}

.points-pill {
  display: flex;
  min-height: 44px;
  padding: 0 15px;
  gap: 4px;
  align-items: center;
  border: 1px solid #ddd4ff;
  border-radius: 999px;
  background: white;
  font-size: 16px;
}

.points-pill strong {
  font-size: 18px;
}

main {
  padding: 8px 22px 118px;
}

.onboarding {
  padding-bottom: 36px;
  text-align: center;
}

.hero-art {
  position: relative;
  width: 230px;
  height: 210px;
  margin: 12px auto 22px;
}

.orbit {
  position: absolute;
  inset: 20px;
  border: 2px solid rgba(107, 78, 255, 0.15);
  border-radius: 48% 52% 46% 54%;
  transform: rotate(20deg);
}

.orbit-two {
  inset: 42px 6px;
  border-color: rgba(255, 164, 110, 0.26);
  transform: rotate(-25deg);
}

.avatar-placeholder {
  position: absolute;
  inset: 24px 36px 20px;
  display: grid;
  place-items: center;
  border: 8px solid white;
  border-radius: 48% 48% 44% 44%;
  background: linear-gradient(155deg, #ffd8bd, #eadfff 55%, #a992ff);
  box-shadow: var(--shadow);
  font-size: 84px;
}

.hero-star {
  position: absolute;
  z-index: 2;
  color: #ffad5c;
  font-size: 28px;
}

.star-one {
  top: 24px;
  right: 10px;
}

.star-two {
  bottom: 26px;
  left: 8px;
  color: var(--primary);
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

h1,
h2,
p {
  word-break: keep-all;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 9vw, 44px);
  line-height: 1.16;
  letter-spacing: -0.055em;
}

h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.3;
  letter-spacing: -0.04em;
}

.lead {
  max-width: 360px;
  margin: 14px auto 26px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.setup-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: white;
  box-shadow: var(--shadow);
  text-align: left;
}

.form-help {
  margin: 7px 0 20px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.setup-card > label:not(.consent-row) {
  display: block;
  margin: 16px 0 7px;
  font-size: 16px;
  font-weight: 800;
}

.setup-card input[type="text"],
.setup-card input:not([type]) {
  width: 100%;
}

.setup-card > input {
  width: 100%;
  min-height: 54px;
  padding: 0 15px;
  border: 2px solid var(--line);
  border-radius: 15px;
  background: #fdfcfe;
  color: var(--ink);
  font-size: 18px;
}

.setup-card > input::placeholder {
  color: #aaa5b4;
}

.consent-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 22px 0;
  padding: 15px;
  border-radius: 16px;
  background: var(--lavender);
  cursor: pointer;
}

.consent-row input {
  width: 24px;
  height: 24px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.consent-row span {
  display: grid;
  gap: 5px;
}

.consent-row small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.primary-button {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 18px;
  background: var(--primary);
  color: white;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(107, 78, 255, 0.25);
}

.primary-button:hover {
  background: var(--primary-dark);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.dashboard {
  display: grid;
  gap: 30px;
}

.welcome-row,
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.welcome-row h1 {
  font-size: 34px;
}

.text-button {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.child-card {
  display: grid;
  grid-template-columns: 92px 1fr 48px;
  gap: 15px;
  align-items: center;
  min-height: 148px;
  padding: 18px;
  overflow: hidden;
  border-radius: 28px;
  background: linear-gradient(135deg, #6b4eff, #9879ff);
  color: white;
  box-shadow: 0 20px 40px rgba(91, 64, 207, 0.24);
}

.child-avatar {
  display: grid;
  width: 92px;
  height: 108px;
  place-items: center;
  border: 5px solid rgba(255, 255, 255, 0.75);
  border-radius: 44% 44% 40% 40%;
  background: linear-gradient(150deg, #ffdfc8, #fff3e9);
  font-size: 50px;
}

.privacy-badge {
  display: inline-block;
  margin-bottom: 8px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.17);
  font-size: 12px;
  font-weight: 800;
}

.child-copy h2 {
  font-size: 26px;
}

.child-copy p {
  margin: 5px 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
}

.round-button {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: white;
  font-size: 32px;
}

.guardian-upload-card {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border: 2px dashed #d8cff8;
  border-radius: 24px;
  background: #f7f4ff;
}

.upload-illustration {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border-radius: 18px;
  background: white;
  font-size: 31px;
  box-shadow: 0 8px 20px rgba(71, 50, 113, 0.08);
}

.upload-copy h2 {
  font-size: 20px;
}

.upload-copy p:not(.eyebrow) {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.upload-button {
  grid-column: 1 / -1;
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  background: white;
  color: var(--primary-dark);
  font-size: 17px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px #d8cff8;
}

.upload-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.avatar-studio {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: white;
  box-shadow: 0 14px 35px rgba(71, 50, 113, 0.08);
}

.style-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.style-option {
  min-height: 52px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #faf9fc;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.style-option.selected {
  border-color: var(--primary);
  background: var(--lavender);
  color: var(--primary-dark);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.generation-progress {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  background: #f7f4ff;
}

.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.progress-copy span {
  color: var(--primary-dark);
  font-weight: 900;
}

.generation-progress progress {
  width: 100%;
  height: 14px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  accent-color: var(--primary);
}

.avatar-result {
  display: grid;
  gap: 10px;
  margin: 0;
}

.avatar-result img {
  width: 100%;
  max-height: 430px;
  object-fit: contain;
  border-radius: 22px;
  background: #f7f4ff;
}

.avatar-result figcaption {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.avatar-create-button {
  margin-top: 2px;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 15px;
}

.action-card {
  display: grid;
  min-height: 150px;
  padding: 17px;
  align-content: end;
  justify-items: start;
  border: 0;
  border-radius: 23px;
  color: var(--ink);
  text-align: left;
}

.action-card.warm {
  background: linear-gradient(150deg, #fff1d9, #ffd3b9);
}

.action-card.violet {
  background: linear-gradient(150deg, #eeeaff, #d7cbff);
}

.action-card:disabled {
  cursor: wait;
  opacity: 0.65;
}

.action-icon {
  margin-bottom: auto;
  font-size: 32px;
}

.action-card strong {
  margin-top: 16px;
  font-size: 18px;
}

.action-card small {
  margin-top: 5px;
  color: #5f596d;
  font-size: 14px;
}

.dream-strip {
  display: grid;
  grid-auto-columns: 45%;
  grid-auto-flow: column;
  gap: 12px;
  margin: 15px -22px 0;
  padding: 0 22px 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.dream-card {
  display: grid;
  min-height: 170px;
  padding: 18px;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: 24px;
  scroll-snap-align: start;
}

.dream-card span {
  font-size: 48px;
}

.dream-card strong {
  font-size: 18px;
}

.doctor {
  background: #e1f5ff;
}

.professor {
  background: #fff0d9;
}

.singer {
  background: #f0e7ff;
}

.shop-list {
  display: grid;
  gap: 10px;
  margin-top: 15px;
}

.shop-item {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 13px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}

.shop-emoji {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 15px;
  background: var(--cream);
  font-size: 28px;
}

.shop-copy {
  display: grid;
  gap: 4px;
}

.shop-copy strong {
  font-size: 17px;
}

.shop-copy small {
  color: var(--muted);
}

.buy-button {
  min-width: 76px;
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  border-radius: 15px;
  background: var(--lavender);
  color: var(--primary-dark);
  font-weight: 900;
}

.buy-button.owned {
  background: #edf5ef;
  color: #3d7450;
  cursor: default;
}

.ledger-card {
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: white;
}

.section-heading.compact h2 {
  font-size: 20px;
}

.ledger-list {
  display: grid;
  gap: 0;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.ledger-item {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
}

.ledger-item:first-child {
  border-top: 0;
}

.ledger-copy {
  display: grid;
  gap: 3px;
}

.ledger-copy small {
  color: var(--muted);
}

.ledger-amount {
  font-weight: 900;
}

.ledger-amount.credit {
  color: #3c7660;
}

.ledger-amount.debit {
  color: #c45655;
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(100%, 520px);
  min-height: 82px;
  margin: 0 auto;
  padding: 8px 18px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

.bottom-nav button {
  display: grid;
  min-height: 56px;
  place-items: center;
  gap: 2px;
  border: 0;
  background: transparent;
  color: #918c9c;
  font-size: 13px;
  font-weight: 800;
}

.bottom-nav button span {
  font-size: 25px;
}

.bottom-nav button.active {
  color: var(--primary);
}

.status-toast {
  position: fixed;
  z-index: 40;
  right: 20px;
  bottom: 96px;
  left: 20px;
  width: min(calc(100% - 40px), 480px);
  margin: 0 auto;
  padding: 15px 18px;
  border-radius: 15px;
  background: #2c2640;
  color: white;
  box-shadow: var(--shadow);
  font-size: 16px;
  font-weight: 800;
  text-align: center;
}

@media (min-width: 700px) {
  body {
    padding: 24px 0;
  }

  .app-shell {
    min-height: calc(100vh - 48px);
    border-radius: 30px;
  }

  .bottom-nav {
    bottom: 24px;
    border-radius: 0 0 30px 30px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-star {
    animation: float 3s ease-in-out infinite;
  }

  @keyframes float {
    50% {
      transform: translateY(-7px) rotate(8deg);
    }
  }
}
