:root{
  --bg1:#0b1022;
  --bg2:#1a2a6c;
  --bg3:#b21f1f;
  --bg4:#fdbb2d;
  --stroke: rgba(255,255,255,.18);
  --txt: rgba(255,255,255,.9);
  --muted: rgba(255,255,255,.65);
  --glow: 0 0 24px rgba(255,255,255,.12), 0 0 72px rgba(127,255,212,.14);
  --shadow: 0 18px 60px rgba(0,0,0,.35);
  --radius: 22px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-rounded, system-ui, -apple-system, "SF Pro Display", "Apple SD Gothic Neo", Pretendard, sans-serif;
  color:var(--txt);
  overflow:hidden;
  background: radial-gradient(1200px 800px at 20% 10%, rgba(255,255,255,.10), transparent 55%),
              radial-gradient(900px 700px at 90% 20%, rgba(120,180,255,.18), transparent 60%),
              linear-gradient(135deg, var(--bg1), #0f1733 45%, #090c1a);
}

.app{
  position:relative;
  height:100%;
  display:grid;
  place-items:center;
  padding:24px;
}

/* dynamic gradient layer */
.app::before{
  content:"";
  position:absolute;
  inset:-35%;

  background:
    radial-gradient(70% 70% at 20% 30%, rgba(120,170,255,.45), transparent 70%),
    radial-gradient(70% 70% at 80% 70%, rgba(255,160,120,.40), transparent 72%),
    radial-gradient(80% 80% at 50% 50%, rgba(180,140,255,.35), transparent 75%),
    linear-gradient(120deg, var(--bg2), var(--bg3), var(--bg4));

  background-size: 220% 220%;
  filter: blur(45px) saturate(135%) brightness(110%);
  opacity:.75;

  animation: backgroundFlowStrong 18s ease-in-out infinite alternate;
}

@keyframes backgroundFlowStrong{
  0%{
    background-position: 0% 30%;
    transform: rotate(-10deg) scale(1.05);
  }
  50%{
    background-position: 70% 60%;
    transform: rotate(-6deg) scale(1.12);
  }
  100%{
    background-position: 100% 50%;
    transform: rotate(-12deg) scale(1.07);
  }
}

.top{
  position:absolute;
  top:18px;
  width:min(920px, 96vw);
  display:flex;
  justify-content:space-between;
  align-items:center;
  z-index:5;
}

.badge{
  padding:10px 14px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  backdrop-filter: blur(10px);
  border-radius:999px;
  letter-spacing:.4px;
  box-shadow: var(--glow);
}

.icon-btn{
  width:44px;height:44px;
  border-radius:14px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.07);
  color:var(--txt);
  cursor:pointer;
  box-shadow: var(--glow);
  transition: transform .15s ease, background .2s ease;
}
.icon-btn:hover{ transform: translateY(-1px) scale(1.02); background: rgba(255,255,255,.10); }
.icon-btn:active{ transform: translateY(0) scale(.98); }

.card{
  width:min(920px, 96vw);
  padding:28px 26px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.06));
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow), var(--glow);
  position:relative;
  z-index:4;
}

.title{
  margin:6px 0 8px;
  font-size: clamp(22px, 3.2vw, 36px);
  letter-spacing:-.6px;
  text-shadow: 0 0 26px rgba(255,255,255,.16);
}
.subtitle{
  margin:0 0 18px;
  color:var(--muted);
  line-height:1.5;
}

.input-row{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin: 10px 0 14px;
}
input{
  flex:1 1 280px;
  padding:14px 14px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.20);
  background: rgba(0,0,0,.18);
  color:var(--txt);
  outline:none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
input::placeholder{ color: rgba(255,255,255,.45); }

.cta{
  flex:0 0 auto;
  padding:14px 18px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.22);
  cursor:pointer;
  color:#071018;
  font-weight:700;
  background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(175,255,236,.86));
  box-shadow: 0 14px 32px rgba(127,255,212,.18), 0 0 40px rgba(255,255,255,.12);
  position:relative;
  overflow:hidden;
  transition: transform .15s ease, filter .2s ease;
}
.cta::after{
  content:"";
  position:absolute;
  inset:-40%;
  background: radial-gradient(circle at 30% 40%, rgba(255,255,255,.8), transparent 55%),
              radial-gradient(circle at 70% 60%, rgba(127,255,212,.55), transparent 60%);
  transform: rotate(18deg);
  opacity:.65;
  animation: shimmer 2.8s ease-in-out infinite alternate;
}
@keyframes shimmer{
  from{ transform: rotate(16deg) translate(-2%, -1%); }
  to{ transform: rotate(20deg) translate(2%, 1%); }
}
.cta:hover{ transform: translateY(-1px) scale(1.01); filter:saturate(115%); }
.cta:active{ transform: translateY(0) scale(.98); }
.arrow{ display:inline-block; margin-left:6px; transform: translateY(-1px); }

.chips{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin: 6px 0 18px;
}
.chip{
  border:1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color:rgba(255,255,255,.88);
  padding:10px 12px;
  border-radius:999px;
  cursor:pointer;
  transition: transform .15s ease, background .2s ease;
}
.chip:hover{ transform: translateY(-1px); background: rgba(255,255,255,.09); }
.chip:active{ transform: translateY(0) scale(.98); }

.result{
  display:grid;
  grid-template-columns: 1fr 1.2fr;
  gap:18px;
  padding:16px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.10);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}

/* =========================
   SWATCH (feather edge)
   ========================= */

.swatches{
  display:grid;
  grid-template-rows: repeat(3, 1fr);
  gap:10px;
  min-height:180px;
}

.swatch{
  position: relative;
  border-radius: 22px;
  overflow: hidden;

  /* ✅ 배경이 살짝 비치게 */
  opacity: .86;

  border: none;
  box-shadow:
    0 12px 30px rgba(0,0,0,.22),
    0 0 28px rgba(255,255,255,.06);

  /* ✅ 핵심: 가장자리만 자연스럽게 투명해지는 feather */
  -webkit-mask-image: radial-gradient(
    120% 120% at 50% 50%,
    rgba(0,0,0,1) 72%,
    rgba(0,0,0,.85) 80%,
    rgba(0,0,0,.35) 92%,
    rgba(0,0,0,0) 100%
  );
  mask-image: radial-gradient(
    120% 120% at 50% 50%,
    rgba(0,0,0,1) 72%,
    rgba(0,0,0,.85) 80%,
    rgba(0,0,0,.35) 92%,
    rgba(0,0,0,0) 100%
  );
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

/* ✅ 내부 '그라데이션이 흐르는' 모션(유지/개선) */
.swatch::before{
  content:"";
  position:absolute;
  inset:-40%;
  background:
    radial-gradient(60% 80% at 20% 30%, rgba(255,255,255,.28), transparent 60%),
    radial-gradient(60% 80% at 80% 70%, rgba(255,255,255,.20), transparent 62%),
    linear-gradient(120deg, rgba(255,255,255,.08), transparent 45%, rgba(255,255,255,.10));
  background-size: 140% 140%, 160% 160%, 200% 200%;
  filter: blur(14px);
  opacity: .55;
  transform: translate3d(-2%, -2%, 0);
  animation: swatchFlow 9.5s ease-in-out infinite alternate;
  pointer-events:none;
}

/* 살짝 빛결만 (선처럼 보이지 않게 아주 약하게) */
.swatch::after{
  content:"";
  position:absolute;
  inset:-60%;
  background: linear-gradient(135deg,
    rgba(255,255,255,0),
    rgba(255,255,255,.14),
    rgba(255,255,255,0)
  );
  opacity:.18;
  filter: blur(16px);
  transform: rotate(18deg);
  animation: swatchSheen 8.5s ease-in-out infinite alternate;
  pointer-events:none;
}

@keyframes swatchFlow{
  from{ transform: translate3d(-4%, -3%, 0) scale(1.02); }
  to  { transform: translate3d(4%, 3%, 0) scale(1.06); }
}
@keyframes swatchSheen{
  from{ transform: rotate(16deg) translate3d(-2%, -1%, 0); opacity:.12; }
  to  { transform: rotate(22deg) translate3d(2%, 1%, 0); opacity:.22; }
}

.meta{
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  gap:12px;
}
.label{
  font-size:12px;
  letter-spacing: .14em;
  color: rgba(255,255,255,.55);
}
.mood{
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight:800;
  margin-left:10px;
  text-shadow: 0 0 22px rgba(255,255,255,.18);
}
.hex{
  display:inline-block;
  margin-left:10px;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
}

.actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.ghost{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.88);
  cursor:pointer;
  transition: transform .15s ease, background .2s ease;
}
.ghost:hover{ transform: translateY(-1px); background: rgba(255,255,255,.09); }
.ghost:active{ transform: translateY(0) scale(.98); }

.hint{
  margin-top:14px;
  color: rgba(255,255,255,.55);
  font-size: 13px;
}

/* base sparkles */
.sparkles{
  position:absolute;
  inset:0;
  z-index:2;
  pointer-events:none;
  background:
    radial-gradient(2px 2px at 12% 28%, rgba(255,255,255,.85), transparent 60%),
    radial-gradient(1.5px 1.5px at 22% 74%, rgba(255,255,255,.65), transparent 60%),
    radial-gradient(2.5px 2.5px at 78% 18%, rgba(255,255,255,.75), transparent 60%),
    radial-gradient(1.8px 1.8px at 86% 62%, rgba(255,255,255,.70), transparent 60%),
    radial-gradient(2.2px 2.2px at 56% 86%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1.7px 1.7px at 42% 34%, rgba(255,255,255,.60), transparent 60%);
  opacity:.55;
  animation: twinkle 3.6s ease-in-out infinite alternate;
}
@keyframes twinkle{
  from{ opacity:.35; filter: blur(.2px); transform: translateY(0); }
  to{ opacity:.75; filter: blur(.0px); transform: translateY(-6px); }
}

/* orbs */
.orb{
  position:absolute;
  border-radius:999px;
  filter: blur(14px) saturate(150%);
  opacity:.35;
  z-index:1;
  animation: orb 10s ease-in-out infinite alternate;
}
.orb-a{ width:280px; height:280px; left:6%; top:18%; background: radial-gradient(circle, rgba(127,255,212,.9), transparent 60%); }
.orb-b{ width:360px; height:360px; right:8%; top:8%; background: radial-gradient(circle, rgba(180,140,255,.9), transparent 62%); animation-duration: 12s; }
.orb-c{ width:420px; height:420px; left:24%; bottom:-12%; background: radial-gradient(circle, rgba(255,215,140,.9), transparent 62%); animation-duration: 14s; }
@keyframes orb{
  from{ transform: translate(-8px, 6px) scale(1.02); }
  to{ transform: translate(10px, -6px) scale(1.08); }
}

@media (max-width: 760px){
  .result{ grid-template-columns: 1fr; }
}

/* ===== Fullscreen Overlay: text-only ===== */
.overlay{
  position: fixed;
  inset: 0;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .55s ease;
  background: #070a17;          /* ✅ 완전 불투명 베이스 */
  isolation: isolate;  
}
.overlay.show{
  opacity: 1;
  pointer-events: auto;
}

/* ✅ 움직이는 그라데이션 배경 (CSS 변수로 색 받음) */
.overlay-bg{
  position:absolute;
  inset:-22%;
  opacity: 1;
  transform: scale(1.06);

  /* palette */
  --c1: #77FFD2;
  --c2: #7AA7FF;
  --c3: #F6FF7A;

  background:
    radial-gradient(900px 650px at 20% 20%, color-mix(in srgb, var(--c1) 80%, transparent), transparent 62%),
    radial-gradient(900px 650px at 80% 30%, color-mix(in srgb, var(--c2) 80%, transparent), transparent 64%),
    radial-gradient(1000px 700px at 50% 85%, color-mix(in srgb, var(--c1) 62%, transparent), transparent 66%),
    linear-gradient(135deg, var(--c1), var(--c2), var(--c3));

  background-size: 140% 140%;
  filter: blur(26px) saturate(115%) brightness(102%);
  animation: overlayGradientMove 14s ease-in-out infinite alternate;
}

@keyframes overlayGradientMove{
  0%   { background-position: 0% 30%; transform: scale(1.05) translate(-0.5%, -0.3%); }
  50%  { background-position: 70% 50%; transform: scale(1.08) translate(0.6%, 0.2%); }
  100% { background-position: 100% 70%; transform: scale(1.06) translate(-0.2%, 0.5%); }
}

.overlay-sparkles{
  position:absolute;
  inset:0;
  pointer-events:none;
  background:
    radial-gradient(2px 2px at 12% 18%, rgba(255,255,255,.85), transparent 60%),
    radial-gradient(1.5px 1.5px at 22% 74%, rgba(255,255,255,.65), transparent 60%),
    radial-gradient(2.2px 2.2px at 78% 22%, rgba(255,255,255,.75), transparent 60%),
    radial-gradient(1.8px 1.8px at 86% 62%, rgba(255,255,255,.72), transparent 60%),
    radial-gradient(2.2px 2.2px at 56% 86%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1.6px 1.6px at 42% 34%, rgba(255,255,255,.60), transparent 60%);
  opacity:.55;
  animation: overlayTwinkle 3.0s ease-in-out infinite alternate;
}
@keyframes overlayTwinkle{
  from{ opacity:.35; transform: translateY(0); }
  to{ opacity:.82; transform: translateY(-10px); }
}

/* 문장 애니메이션: 사라질 때 위로 살짝 날아감 */
.overlay-line{
  position:absolute;
  position: relative;
  left:50%;
  top:50%;
  width: min(980px, 92vw);
  text-align:center;

  font-weight: 800;
  font-size: clamp(20px, 3vw, 42px);
  letter-spacing: -.7px;
  line-height: 1.35;
  color: rgba(255,255,255,.92);
  text-shadow: 0 0 30px rgba(255,255,255,.18);

  opacity: 0;
  filter: blur(6px);
  transform: translate(-50%, -50%) translateY(12px);
  transition: opacity 1.2s ease, filter 1.2s ease, transform 1.2s ease;
  text-shadow:
    0 0 12px rgba(255,255,255,.18),
    0 0 28px rgba(180,210,255,.12),
    0 0 70px rgba(120,170,255,.10);
}

.overlay-line.show{
  opacity: 1;
  filter: blur(0px);
  transform: translate(-50%, -50%) translateY(0px);
  text-shadow:
    0 0 18px rgba(255,255,255,.35),
    0 0 46px rgba(200,225,255,.22),
    0 0 120px rgba(140,190,255,.16);

  animation: glowPop 1.4s ease-out both;
}

.overlay-line.hide{
  opacity: 0;
  filter: blur(8px);
  transform: translate(-50%, -50%) translateY(-18px); /* ✅ 위로 살짝 */
}

/* 기본은 숨김 */
.overlay-close{
  opacity:0;
  pointer-events:none;
  transition: opacity .3s ease;
}

/* overlay가 보일 때만 X 보이게 */
.overlay.show .overlay-close{
  opacity:1;
  pointer-events:auto;
}

.overlay-close{
  position:absolute;
  top:18px;
  right:18px;
  width:44px;
  height:44px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.9);
  cursor:pointer;
  backdrop-filter: blur(10px);
}
.overlay-close:hover{ background: rgba(255,255,255,.12); }

/* ✅ 별빛 레이어를 더 풍부하게 + 반짝반짝 */
.sparkles{
  opacity: .75;
  animation: starTwinkle 3.8s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 6px rgba(255,255,255,.18));
}

.app::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:3;
  background:
    radial-gradient(1px 1px at 8% 22%, rgba(255,255,255,.9), transparent 55%),
    radial-gradient(1px 1px at 18% 72%, rgba(255,255,255,.8), transparent 55%),
    radial-gradient(1px 1px at 44% 18%, rgba(255,255,255,.7), transparent 55%),
    radial-gradient(1px 1px at 63% 64%, rgba(255,255,255,.9), transparent 55%),
    radial-gradient(1px 1px at 82% 28%, rgba(255,255,255,.75), transparent 55%),
    radial-gradient(1px 1px at 91% 78%, rgba(255,255,255,.85), transparent 55%);
  opacity:.45;
  animation: starDrift 9.5s ease-in-out infinite alternate;
}

/* =========================
   MOVING SPARKLE PARTICLES
   ========================= */

.overlay-stars{
  position:absolute;
  inset:0;
  pointer-events:none;
  overflow:hidden;
  z-index:5;
}

.star{
  position:absolute;
  width:4px;
  height:4px;
  border-radius:50%;
  background:white;
  opacity:0;
  filter: drop-shadow(0 0 6px white);
  animation: sparkle var(--duration) ease-in-out forwards;
}

@keyframes sparkle{
  0%{
    opacity:0;
    transform: scale(.3) translateY(0px);
  }
  20%{
    opacity:.6;   /* ↓ 1 → .6 */
    transform: scale(1.2) translateY(-4px);
  }
  50%{
    opacity:.45;  /* ↓ .8 → .45 */
    transform: scale(1) translateY(-8px);
  }
  100%{
    opacity:0;
    transform: scale(.2) translateY(-14px);
  }
}

/* =========================
   TEXT AURORA GLOW (behind)
   ========================= */

/* =========================
   STRONG AURORA GLOW
   ========================= */

.overlay-line{
  position: relative;
  z-index: 10;
}

/* 강한 오로라 안개 */
.overlay-line::before{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width: min(1100px, 95vw);
  height: 380px;
  transform: translate(-50%, -50%);
  pointer-events:none;
  z-index:-1;

  background:
    radial-gradient(closest-side at 25% 45%, rgba(120,170,255,.45), transparent 70%),
    radial-gradient(closest-side at 75% 55%, rgba(140,255,220,.40), transparent 72%),
    radial-gradient(closest-side at 50% 75%, rgba(255,220,140,.35), transparent 72%),
    radial-gradient(closest-side at 50% 40%, rgba(255,255,255,.30), transparent 65%);

  filter: blur(38px);
  opacity: 0;

  animation: strongAuroraMove 10s ease-in-out infinite alternate;
  transition: opacity 1.4s ease;
}

/* 문장 등장 시 강하게 켜짐 */
.overlay-line.show::before{
  opacity: 1;
}

/* 사라질 때 꺼짐 */
.overlay-line.hide::before{
  opacity: 0;
}

@keyframes strongAuroraMove{
  0%{
    transform: translate(-50%, -50%) scale(1.05) rotate(-3deg);
    filter: blur(42px);
  }
  50%{
    transform: translate(-50%, -50%) scale(1.12) rotate(2deg);
    filter: blur(34px);
  }
  100%{
    transform: translate(-50%, -50%) scale(1.08) rotate(-2deg);
    filter: blur(38px);
  }
}

