*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* 에르메스 팔레트 */
  --bg:       #FAF5EE;
  --bg2:      #F3EBE0;
  --surface:  rgba(255, 250, 244, 0.82);
  --surface2: rgba(255, 246, 236, 0.90);
  --border:   rgba(180, 140, 100, 0.18);
  --border2:  rgba(180, 140, 100, 0.28);

  --orange:   #C8521A;   /* 에르메스 시그니처 오렌지 */
  --orange2:  #A83E0E;
  --orange-glow: rgba(200, 82, 26, 0.2);

  --brown:    #2C1A0E;
  --warm:     #6B4226;
  --muted:    #9A7B5E;
  --dim:      #C4A882;

  --text:     #2C1A0E;

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --r:  20px;
  --blur: blur(20px);
}

html, body {
  height: 100%;
  background: linear-gradient(150deg, #EDE3D5 0%, var(--bg) 50%, #F5EDE0 100%);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  font-family: 'Nanum Gothic', 'Poppins', sans-serif;
}

/* particle canvas */
#particles { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.screen, .lang-bar { position: relative; z-index: 1; }

/* ── Lang bar ────────────────────────────────────────────────────────── */
.lang-bar {
  position: fixed;
  top: calc(var(--safe-top) + 14px);
  right: 16px;
  display: flex;
  gap: 2px;
  z-index: 200;
  background: rgba(255, 250, 244, 0.88);
  border: 1px solid var(--border2);
  border-radius: 999px;
  padding: 4px 8px;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: 0 2px 16px rgba(100, 60, 20, .1);
}
.lang-btn {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
  background: none;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  transition: color .2s, background .2s;
  border-radius: 999px;
}
.lang-btn.active {
  color: #fff;
  background: var(--orange);
}
.lang-btn:not(:last-child)::after {
  content: "·";
  margin-left: 6px;
  color: var(--dim);
}

/* ── Screens ─────────────────────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active {
  display: flex;
  flex-direction: column;
  animation: rise .42s cubic-bezier(.22, 1, .36, 1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 60px) 26px calc(var(--safe-bottom) + 40px);
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

/* ── Intro ───────────────────────────────────────────────────────────── */
#intro-screen .inner { justify-content: center; }

.brand {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 18px;
}

.intro-mbti {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(72px, 22vw, 96px);
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--brown);
  line-height: 1;
  margin-bottom: 4px;
  animation: floatY 6s ease-in-out infinite;
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
.intro-mbti span { color: var(--orange); }

.intro-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  font-style: italic;
  color: var(--warm);
  margin-bottom: 10px;
}
.intro-sub {
  font-size: 14px;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.85;
  margin-bottom: 52px;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 17px;
  background: linear-gradient(135deg, var(--orange), var(--orange2));
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1.5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
  transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s;
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
    transparent 40%,
    rgba(255, 255, 255, .28) 50%,
    transparent 60%);
  background-size: 200% 100%;
  background-position: -200% center;
  transition: background-position .5s ease;
}
.btn-primary:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 8px 28px var(--orange-glow);
}
.btn-primary:hover::after { background-position: 200% center; }
.btn-primary:active {
  transform: scale(.96);
  transition: transform .08s;
}

.btn-ghost {
  display: block;
  width: 100%;
  padding: 16px;
  background: var(--surface2);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: var(--warm);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .2s, color .2s,
              transform .22s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s;
}
.btn-ghost:hover {
  border-color: var(--orange);
  color: var(--orange);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--orange-glow);
}
.btn-ghost:active { transform: scale(.97); }

.btn-contact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  background: transparent;
  color: var(--muted);
  border: 1.5px dashed var(--dim);
  border-radius: var(--r);
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .2s, border-color .2s, background .2s;
}
.btn-contact:hover {
  color: var(--warm);
  border-color: var(--muted);
  background: var(--surface2);
}
.btn-contact svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Ripple ──────────────────────────────────────────────────────────── */
.ripple-el {
  position: absolute;
  border-radius: 50%;
  background: rgba(200, 82, 26, .2);
  transform: scale(0);
  animation: rippleAnim .6s linear forwards;
  pointer-events: none;
}
@keyframes rippleAnim { to { transform: scale(5); opacity: 0; } }

/* ── Progress ────────────────────────────────────────────────────────── */
.prog-wrap { margin-bottom: 40px; }
.prog-bar {
  height: 3px;
  background: var(--border2);
  border-radius: 3px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange2), var(--orange));
  transition: width .5s cubic-bezier(.4, 0, .2, 1);
  border-radius: 3px;
}
.prog-num {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 2px;
  margin-top: 10px;
  text-align: right;
}

/* ── Question ────────────────────────────────────────────────────────── */
.q-axis {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--orange);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.q-scenario {
  font-size: 19px;
  font-weight: 700;
  color: var(--brown);
  line-height: 1.55;
  margin-bottom: 10px;
}
.q-text {
  font-size: 14px;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 28px;
}

/* ── Choices ─────────────────────────────────────────────────────────── */
.choices { display: flex; flex-direction: column; gap: 12px; }

.choice-btn {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--border2);
  border-radius: var(--r);
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px);
  transition: border-color .2s, background .2s,
              transform .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s;
}
.choice-btn.slide-in {
  animation: slideUp .4s cubic-bezier(.22, 1, .36, 1) forwards;
}
.choice-btn.slide-in:nth-child(2) { animation-delay: .08s; }
@keyframes slideUp { to { opacity: 1; transform: translateY(0); } }

.choice-btn:hover {
  border-color: var(--orange);
  box-shadow: 0 0 0 1px var(--orange), 0 6px 24px var(--orange-glow);
  transform: translateY(-3px);
}
.choice-btn:active { transform: scale(.97); transition-duration: .08s; }

.choice-btn.selected {
  background: linear-gradient(135deg,
    rgba(200,82,26,.1),
    rgba(168,62,14,.07));
  border-color: var(--orange);
  box-shadow: 0 0 0 1px var(--orange), 0 8px 28px var(--orange-glow);
}
.choice-btn.selected .choice-label {
  color: var(--orange);
  border-color: var(--orange);
}
.choice-btn.selected .choice-text { color: var(--brown); }

.choice-label {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--dim);
  border: 1px solid var(--border2);
  border-radius: 10px;
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color .2s, border-color .2s;
}
.choice-text {
  font-size: 15px;
  font-weight: 400;
  color: var(--warm);
  line-height: 1.65;
  padding-top: 4px;
  transition: color .2s;
}

/* ── Result — Instagram 감성 ─────────────────────────────────────────── */
#result-screen { overflow-y: auto; }

#share-card {
  position: relative;
  padding: 28px 24px;
  border-radius: var(--r);
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border2);
  margin-bottom: 28px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(100, 60, 20, .1);
}
#share-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgba(200,82,26,.05) 0%,
    transparent 60%,
    rgba(200,82,26,.03) 100%);
  pointer-events: none;
}
#share-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--orange2), var(--orange), #E8956D);
}

.res-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--orange);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.res-type {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(56px, 16vw, 80px);
  font-weight: 700;
  letter-spacing: 6px;
  line-height: 1;
  margin-bottom: 4px;
  overflow: visible;
  color: var(--brown);
  animation: popIn .6s cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(.65); }
  to   { opacity: 1; transform: scale(1); }
}
.res-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 20px;
  font-style: italic;
  color: var(--orange);
  margin-bottom: 20px;
}
.res-desc {
  font-size: 15px;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.9;
}

.deco-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.deco-line::before, .deco-line::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border2);
}
.deco-line span {
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 3px;
  text-transform: uppercase;
}
.thin-line {
  border: none;
  border-top: 1px solid var(--border);
  margin: 22px 0;
}

.axis-bar { margin-bottom: 20px; }
.axis-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.axis-side { font-size: 11px; color: var(--muted); }
.axis-val {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--orange);
}
.axis-track {
  height: 4px;
  background: var(--border2);
  border-radius: 4px;
  overflow: hidden;
}
.axis-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange2), var(--orange));
  border-radius: 4px;
  width: 0;
  transition: width 1.6s cubic-bezier(.4, 0, .2, 1);
}

.sec-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.sec-label::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.tag {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s;
}
.tag:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 4px 14px rgba(100, 60, 20, .15);
}
.tag-str {
  background: rgba(200, 82, 26, .1);
  color: var(--orange);
  border: 1px solid rgba(200, 82, 26, .22);
}
.tag-wkn {
  background: rgba(107, 66, 38, .08);
  color: var(--warm);
  border: 1px solid rgba(107, 66, 38, .18);
}
.tag-cmp {
  background: var(--surface2);
  color: var(--brown);
  border: 1px solid var(--border2);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* ── Share ───────────────────────────────────────────────────────────── */
.share-wrap { margin-bottom: 26px; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  border: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  color: #fff;
  position: relative;
  overflow: hidden;
  transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s, opacity .15s;
}
.share-btn:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 6px 18px rgba(0,0,0,.2);
}
.share-btn:active { opacity: .8; transform: scale(.95); }
.share-btn svg { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }

.s-x    { background: #111; }
.s-fb   { background: #1877F2; }
.s-wa   { background: #25D366; }
.s-line { background: #06C755; }
.s-copy { background: var(--surface2); color: var(--warm); border: 1px solid var(--border2); }
.s-img  { background: linear-gradient(135deg, var(--orange2), var(--orange)); }

.copied-msg { font-size: 12px; color: var(--orange); margin-top: 8px; min-height: 16px; }
.contact-wrap { margin-bottom: 28px; }

/* ── Sparkles ────────────────────────────────────────────────────────── */
.spark {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  border-radius: 50%;
  animation: sparkFly .9s ease-out forwards;
}
@keyframes sparkFly {
  0%   { opacity: 1; transform: scale(1) translate(0, 0); }
  100% { opacity: 0; transform: scale(0) translate(var(--tx), var(--ty)); }
}

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 599px) {
  .screen.active {
    margin: 10px 10px 0;
    min-height: calc(100dvh - 10px);
    background: rgba(255, 250, 244, 0.84);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-radius: 26px 26px 0 0;
    border: 1px solid var(--border2);
    border-bottom: none;
    box-shadow: 0 -6px 40px rgba(100, 60, 20, .12);
  }
}

@media (min-width: 600px) {
  body { display: flex; align-items: center; justify-content: center; }
  .screen { min-height: unset; width: 100%; }
  .screen.active {
    min-height: unset;
    background: rgba(255, 250, 244, 0.86);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border2);
    border-radius: 26px;
    max-width: 480px;
    margin: 40px auto;
    box-shadow: 0 20px 60px rgba(100, 60, 20, .15);
  }
  .inner { padding: 54px 50px; }
}
