:root{
  --pad: 18px;
  --r: 18px;
  --btn-h: 72px;

  --bgBase: #2C353C;
  --bg1: #232D35;
  --bg2: #2C353C;
  --bg3: #121A20;

  --line: rgba(255,255,255,.12);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.62);

  --shadow: 0 18px 60px rgba(0,0,0,.38);
  --shadow2: 0 10px 30px rgba(0,0,0,.28);
  --focusRing: 0 0 0 3px rgba(255,255,255,.12);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; margin: 0; }

/* iOS 오버스크롤/밴딩 구간에서도 배경색이 안 바뀌게 바닥색 고정 */
html{
  background: var(--bgBase);
  overscroll-behavior-y: none;
}
body{
  background: transparent; /* 중요: 배경은 아래 fixed 레이어가 담당 */
  color: var(--text);
  font-family:
    Pretendard,
    "Pretendard",
    -apple-system,
    BlinkMacSystemFont,
    "Hiragino Kaku Gothic ProN",
    "Noto Sans KR",
    "Segoe UI",
    system-ui,
    sans-serif;

  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
}

/* ===== fixed background layer (1장으로 통합) ===== */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;

  /* 배경 그라데이션 + 은은한 라이트 */
  background:
    radial-gradient(900px 520px at 18% 0%, rgba(255,255,255,.10), transparent 55%),
    radial-gradient(760px 460px at 82% 18%, rgba(255,255,255,.08), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg2) 52%, var(--bg3));

  /* iOS에서 fixed 레이어가 스크롤과 섞여 보이는 경우 방지 */
  transform: translateZ(0);
}

/* 비네팅 + 그레인도 fixed로 한 장에 */
body::after{
  content:"";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;

  background:
    /* vignette */
    radial-gradient(1200px 700px at 50% 18%, rgba(255,255,255,.05), transparent 62%),
    radial-gradient(900px 520px at 50% 120%, rgba(0,0,0,.55), transparent 60%),
    radial-gradient(900px 520px at -10% 50%, rgba(0,0,0,.45), transparent 65%),
    radial-gradient(900px 520px at 110% 50%, rgba(0,0,0,.45), transparent 65%),

    /* subtle grain (no blend-mode) */
    repeating-linear-gradient(0deg, rgba(255,255,255,.08) 0, rgba(255,255,255,.08) 1px, transparent 1px, transparent 3px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.06) 0, rgba(0,0,0,.06) 1px, transparent 1px, transparent 4px);

  opacity: .16;
  filter: blur(.25px);
  transform: translateZ(0);
}

/* ===== layout ===== */
.app{
  min-height: 100dvh;
  padding:
    calc(env(safe-area-inset-top) + 14px)
    calc(env(safe-area-inset-right) + var(--pad))
    calc(env(safe-area-inset-bottom) + 18px)
    calc(env(safe-area-inset-left) + var(--pad));
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  max-width: 860px;
  margin: 0 auto;
  position: relative;
}

/* Top bar */
.top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  position: relative;
  padding-bottom: 6px;
}

/* gadget light bar (2-line, ends stronger) */
.top::after{
  content:"";
  position:absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 10px;
  pointer-events:none;
  background:
    radial-gradient(60px 10px at 6% 50%, rgba(255,255,255,.28), transparent 70%),
    radial-gradient(60px 10px at 94% 50%, rgba(255,255,255,.28), transparent 70%),
    linear-gradient(90deg, transparent, rgba(255,255,255,.18) 18%, rgba(255,255,255,.26) 50%, rgba(255,255,255,.18) 82%, transparent);
  opacity: .70;
  filter: blur(.2px);
}
.top::before{
  content:"";
  position:absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 2px;
  pointer-events:none;
  background:
    linear-gradient(90deg, transparent, rgba(255,255,255,.18) 18%, rgba(255,255,255,.22) 50%, rgba(255,255,255,.18) 82%, transparent);
  opacity: .55;
}

.topRight{
  display:flex;
  align-items:center;
  gap: 10px;
}

.brand{
  font-size: 20px;
  letter-spacing: .02em;
  color: rgba(255,255,255,.72);
  line-height: 1.2;
  text-shadow: 0 1px 0 rgba(0,0,0,.25);
}

/* progress dots */
.progress{ display:flex; gap: 8px; }
.dot{
  width: 8px; height: 8px; border-radius: 999px;
  background: rgba(255,255,255,.18);
  box-shadow: 0 0 0 1px rgba(0,0,0,.25) inset;
}
.dot.is-on{
  background: rgba(255,255,255,.92);
  box-shadow: 0 0 10px rgba(255,255,255,.22), 0 0 0 1px rgba(0,0,0,.18) inset;
}

/* Language Select */
.langSelect,
#langSelect{
  height: 38px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.92);
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  box-shadow: 0 10px 26px rgba(0,0,0,.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
#langSelect:focus{ box-shadow: 0 10px 26px rgba(0,0,0,.18), var(--focusRing); }
#langSelect option{ color: #111; background: #fff; }

/* Stage */
.stage{
  border: 1px solid rgba(255,255,255,.14);
  border-radius: calc(var(--r) + 4px);
  padding: 18px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap: 14px;
  overflow: visible;
  background:
    radial-gradient(800px 420px at 12% 0%, rgba(255,255,255,.08), transparent 55%),
    radial-gradient(760px 420px at 88% 30%, rgba(255,255,255,.06), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  box-shadow: var(--shadow);
  position: relative;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.stage::before{
  content:"";
  position:absolute;
  left: 12px;
  right: 12px;
  top: 10px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent);
  opacity: .7;
}

.h1{
  font-size: 28px;
  line-height: 1.2;
  margin: 0;
  letter-spacing: .01em;
}
.p{
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}
.small{
  margin: 0;
  color: rgba(255,255,255,.55);
  font-size: 13px;
  line-height: 1.5;
}

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

/* Buttons */
.btn{
  height: var(--btn-h);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background:
    radial-gradient(600px 200px at 20% 20%, rgba(255,255,255,.08), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  color: var(--text);
  font-size: 18px;
  text-align: left;
  padding: 0 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 14px 34px rgba(0,0,0,.25);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.btn:hover{ border-color: rgba(255,255,255,.20); }
.btn:active{ transform: translateY(1px); box-shadow: 0 10px 26px rgba(0,0,0,.22); }

/* Cards */
.card{
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  padding: 16px;
  background:
    radial-gradient(700px 240px at 10% 0%, rgba(255,255,255,.07), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  box-shadow: var(--shadow2);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.card::after{
  content:"";
  position:absolute;
  inset:-40px -40px auto -40px;
  height: 90px;
  background: radial-gradient(220px 60px at 50% 50%, rgba(255,255,255,.06), transparent 70%);
  opacity: .8;
  pointer-events:none;
}
.cardTitle{
  font-size: 22px;
  margin: 0 0 6px 0;
  letter-spacing: .01em;
}
.cardText{
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

/* Tags */
.tags{
  margin-top: 10px;
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag{
  border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  color: rgba(255,255,255,.78);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
  box-shadow: 0 10px 18px rgba(0,0,0,.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Bottom */
.bottom{
  display:flex;
  justify-content:flex-end;
  padding-top: 6px;
}
.ghost{
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.70);
  padding: 0 14px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 12px 26px rgba(0,0,0,.20);
  transition: transform .12s ease, border-color .12s ease;
}
.ghost:hover{ border-color: rgba(255,255,255,.22); }
.ghost:active{ transform: translateY(1px); }

.row2{
  display:grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 740px){
  .row2{ grid-template-columns: 1fr 1fr; }
}

/* Keep scrolling stable */
#app, main{
  min-height: 100vh;
  height: auto;
  overflow: visible;
}
/* ========== Scent accent system (Soft Dawn / Still Moss / Nightwalk) ========== */

/* 기본(없을 때) */
:root{
  --accent: rgba(255,255,255,.16);
  --accent2: rgba(255,255,255,.08);
}

/* 향별 포인트 컬러: primary/alt 공통 적용 (중요) */
.card[data-scent="soft_dawn"]{
  --accent: rgba(180, 220, 255, .55);   /* airy clean */
  --accent2: rgba(180, 220, 255, .22);
}
.card[data-scent="still_moss"]{
  --accent: rgba(160, 220, 190, .55);   /* green woody */
  --accent2: rgba(160, 220, 190, .22);
}
.card[data-scent="nightwalk"]{
  --accent: rgba(190, 170, 255, .52);   /* night calm */
  --accent2: rgba(190, 170, 255, .20);
}

/* 결과 카드(추천 향) : 라이트 라인 + 글로우 */
.card.is-primary{
  position: relative;
  overflow: hidden;
}

/* 카드 내용이 pseudo-element 위로 오게 */
.card.is-primary > *{
  position: relative;
  z-index: 1;
}

/* 상단 2줄 라이트 라인(양끝이 살짝 강해지는 가젯 느낌) */
.card.is-primary::before{
  content:"";
  position:absolute;
  left: 14px;
  right: 14px;
  top: 10px;
  height: 6px;              /* 2줄을 위해 높이 살짝 */
  border-radius: 999px;
  background:
    /* 윗줄 */
    linear-gradient(90deg,
      rgba(255,255,255,0),
      color-mix(in srgb, var(--accent) 90%, rgba(255,255,255,.18)) 18%,
      var(--accent) 50%,
      color-mix(in srgb, var(--accent) 90%, rgba(255,255,255,.18)) 82%,
      rgba(255,255,255,0)
    ) 0 0/100% 2px no-repeat,
    /* 아랫줄(조금 더 소프트) */
    linear-gradient(90deg,
      rgba(255,255,255,0),
      color-mix(in srgb, var(--accent2) 85%, rgba(255,255,255,.14)) 18%,
      var(--accent2) 50%,
      color-mix(in srgb, var(--accent2) 85%, rgba(255,255,255,.14)) 82%,
      rgba(255,255,255,0)
    ) 0 4px/100% 2px no-repeat;
  opacity: .95;
  pointer-events:none;
  z-index: 0;
}

/* 아주 은은한 컬러 글로우 */
.card.is-primary::after{
  content:"";
  position:absolute;
  inset: -40px -20px auto -20px;
  height: 140px;
  background: radial-gradient(closest-side, var(--accent2), rgba(0,0,0,0));
  opacity: .9;
  pointer-events:none;
  z-index: 0;
}

/* 태그 칩 포인트(추천 향 카드 안에서만) */
.card.is-primary .tag{
  border-color: rgba(255,255,255,.14);
}
.card.is-primary .tag.is-accent{
  border-color: color-mix(in srgb, var(--accent) 55%, rgba(255,255,255,.14));
  background: color-mix(in srgb, var(--accent2) 60%, rgba(255,255,255,.03));
}

/* ---------- 다른 추천 카드(alt)도 향별 포인트 적용 ---------- */
.card.is-scent{
  position: relative;
  overflow: hidden;
}
.card.is-scent > *{
  position: relative;
  z-index: 1;
}

/* 카드 전체에 아주 얇은 톤 변화 */
.card.is-scent::before{
  content:"";
  position:absolute;
  inset: 0;
  background: linear-gradient(90deg,
    rgba(255,255,255,.02),
    color-mix(in srgb, var(--accent2) 55%, rgba(255,255,255,.02)),
    rgba(255,255,255,.02)
  );
  opacity: .9;
  pointer-events:none;
  z-index: 0;
}

/* alt용 라이트 라인(조금 약하게) */
.card.is-scent::after{
  content:"";
  position:absolute;
  left: 14px;
  right: 14px;
  top: 10px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0),
    color-mix(in srgb, var(--accent) 70%, rgba(255,255,255,.16)),
    rgba(255,255,255,0)
  );
  opacity: .35;
  pointer-events:none;
  z-index: 0;
}
/* 결과 화면 하단 버튼을 '다른 추천 카드' 같은 폭/톤으로 */
.card.section{
  padding: 14px;
}

.btn.btnCard{
  width: 100%;
  height: 88px;           /* 다른 추천 카드 높이감에 맞춤 (원하면 80~96 조절) */
  border-radius: 22px;
  background: rgba(255,255,255,.04);
}
/* 다시 진단하기: 텍스트 가운데 정렬 + 아이콘은 오른쪽 고정 */
.btn.btnCard{
  position: relative;
  justify-content: center;   /* 가운데 정렬 */
  text-align: center;
  padding: 0 64px;           /* 오른쪽 아이콘 공간 확보 */
}

/* 오른쪽 아이콘(↺)만 우측 고정 */
.btn.btnCard > span:last-child{
  position: absolute;
  right: 18px;
}
