/* ============================================================
   월하 月下 — AI 연애 상담  ·  올데이사주 무드
   밝고 부드러운 신비로움 · 새벽하늘 파스텔 · 모바일 우선
   ============================================================ */

@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.css");

:root {
  /* ---- semantic palette (light mystical) ---- */
  --bg:         #F3F0FB;   /* app surface base — soft lilac white */
  --surface:    #FFFFFF;   /* cards */
  --surface-2:  #FAF7FE;   /* subtle raised */
  --surface-3:  #F1ECFA;   /* chip / track tint */

  --text:       #2A2342;   /* deep indigo ink */
  --text-dim:   #6F6788;
  --text-faint: #A49DBC;

  --line:       #ECE6F6;
  --line-2:     #E2DAF1;

  --primary:    #7C5CFF;   /* vivid violet */
  --primary-2:  #9D80FF;   /* lighter violet */
  --primary-deep:#5B3FD6;
  --pink:       #F56FA7;   /* love rose */
  --pink-2:     #FF9CC4;
  --blue:       #5B93F0;   /* celestial blue */
  --amber:      #F2A24E;   /* warm fortune accent */
  --on-primary: #FFFFFF;

  /* hero gradient */
  --grad: linear-gradient(135deg, #7C5CFF 0%, #A86BF0 48%, #F56FA7 100%);
  --grad-soft: linear-gradient(135deg, #EFE9FF, #FBEAF3);

  /* ---- legacy aliases (used by inline styles in JSX) ---- */
  --ink:        var(--on-primary);
  --ink-1:      var(--surface);
  --ink-2:      var(--surface-2);
  --ink-3:      var(--surface-3);
  --ivory:      var(--text);
  --ivory-dim:  var(--text-dim);
  --ivory-faint:var(--text-faint);
  --gold:       var(--primary);
  --gold-2:     var(--primary-2);
  --gold-deep:  var(--primary-deep);
  --rose:       var(--pink);
  --violet:     var(--blue);
  --line-soft:  var(--line);
  --track:      rgba(124, 92, 255, 0.12);

  /* ---- type ---- */
  --serif: "Hahmlet", "Nanum Myeongjo", serif;
  --sans:  "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  /* ---- shape ---- */
  --r-sm: 12px;
  --r:    16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --shadow:      0 18px 50px -18px rgba(89, 63, 180, 0.28);
  --shadow-soft: 0 10px 30px -14px rgba(89, 63, 180, 0.18);
  --shadow-card: 0 6px 22px -10px rgba(89, 63, 180, 0.16);

  --app-w: 480px;
  --bar-h: 72px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  background:
    radial-gradient(800px 500px at 85% -5%, #E5DBFF, transparent 60%),
    radial-gradient(700px 600px at 5% 105%, #FFE0EE, transparent 55%),
    linear-gradient(180deg, #EFEAFB 0%, #F5EEF8 55%, #FCEEF1 100%);
  background-attachment: fixed;
}

::selection { background: rgba(124, 92, 255, 0.22); }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 20px; }
*::-webkit-scrollbar-track { background: transparent; }

.serif { font-family: var(--serif); }
.hanja { font-family: var(--serif); color: var(--primary); }
.eyebrow {
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--primary); font-weight: 700;
}
h1,h2,h3 { font-weight: 700; line-height: 1.18; letter-spacing: -0.02em; color: var(--text); }

/* ============================================================
   APP SHELL — centered mobile-first column
   ============================================================ */
.app {
  position: relative;
  width: 100%;
  max-width: var(--app-w);
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  box-shadow: 0 0 80px -20px rgba(89,63,180,0.25);
}
@media (min-width: 540px) {
  .app { margin: 28px auto; min-height: calc(100dvh - 56px); border-radius: 30px; overflow: hidden; }
  body { padding: 0; }
}

/* top bar */
.appbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  background: rgba(243,240,251,0.82);
  backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .moon {
  width: 32px; height: 32px; border-radius: 50%; flex: none; position: relative;
  background: var(--grad);
  box-shadow: 0 4px 14px -3px rgba(124,92,255,0.55);
}
.brand .moon::after {
  content:""; position:absolute; top:6px; right:6px; width:11px; height:11px;
  border-radius:50%; background: rgba(255,255,255,0.55);
}
.brand .wordmark { line-height: 1; }
.brand .wordmark b { font-family: var(--serif); font-size: 20px; font-weight: 700; display:block; letter-spacing: .01em; }
.brand .wordmark span { font-size: 9.5px; letter-spacing: .26em; color: var(--text-faint); text-transform: uppercase; }
.appbar .avatar {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  background: linear-gradient(135deg, var(--primary-2), var(--pink));
  display: grid; place-items: center; color: #fff; font-family: var(--serif); font-size: 15px;
  box-shadow: var(--shadow-card);
}

/* main — NO inner scroll; the document scrolls (robust paint) */
.main { padding-bottom: calc(var(--bar-h) + 24px); }
.page { padding: 22px 20px 12px; animation: fade .4s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* bottom tab bar */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--app-w); z-index: 40;
  display: flex; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(18px) saturate(1.4);
  border-top: 1px solid var(--line);
}
@media (min-width: 540px) {
  .tabbar { bottom: 28px; border-radius: 0 0 30px 30px; max-width: var(--app-w); border: 1px solid var(--line); border-top: 1px solid var(--line); }
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 7px 2px; color: var(--text-faint); font-size: 10.5px; font-weight: 600;
  cursor: pointer; transition: color .2s; border: none; background: none;
}
.tab .ico { width: 22px; height: 22px; transition: transform .2s; }
.tab.active { color: var(--primary); }
.tab.active .ico { transform: translateY(-1px); }

/* ============================================================
   COMMON UI
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

.btn {
  appearance: none; border: none; cursor: pointer;
  font-family: var(--sans); font-weight: 700; font-size: 15px;
  padding: 15px 22px; border-radius: 16px; color: #fff;
  background: var(--grad);
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  transition: transform .15s ease, box-shadow .2s, filter .2s;
  box-shadow: 0 10px 24px -10px rgba(124,92,255,0.6);
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.04); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .42; cursor: not-allowed; transform: none; filter: none; box-shadow: none; }
.btn.ghost {
  background: var(--surface); color: var(--primary); border: 1.5px solid var(--line-2);
  box-shadow: none;
}
.btn.ghost:hover { background: var(--surface-2); border-color: var(--primary-2); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 9px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  border: 1.5px solid var(--line-2); color: var(--text-dim); background: var(--surface);
  transition: all .18s ease; user-select: none;
}
.chip:hover { color: var(--primary); border-color: var(--primary-2); }
.chip.on { color: #fff; background: var(--grad); border-color: transparent; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 12.5px; color: var(--text-dim); font-weight: 600; padding-left: 2px; }
.input, select.input {
  font-family: var(--sans); font-size: 15.5px; color: var(--text); font-weight: 500;
  background: var(--surface-2); border: 1.5px solid var(--line-2);
  border-radius: 14px; padding: 14px 15px; width: 100%;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.input::placeholder { color: var(--text-faint); font-weight: 400; }
.input:focus, select.input:focus {
  outline: none; border-color: var(--primary-2); background: #fff;
  box-shadow: 0 0 0 4px rgba(124,92,255,0.10);
}
select.input { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237C5CFF' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}

/* page header */
.page-head { margin-bottom: 22px; }
.page-head .eyebrow { margin-bottom: 9px; display:block; }
.page-head h1 { font-family: var(--serif); font-size: 27px; }
.page-head p { color: var(--text-dim); margin-top: 9px; font-size: 14px; line-height: 1.6; text-wrap: pretty; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }

.disclaimer { text-align:center; font-size: 11.5px; color: var(--text-faint); margin-top: 26px; line-height: 1.6; padding: 0 10px; }
