:root {
  --bg1: #2a2350;
  --bg2: #5a4b9a;
  --bg3: #c78bb5;
  --ink: #2b2740;
  --ink-soft: #5d5875;
  --panel: rgba(255, 255, 255, 0.94);
  --line: #e6e1f2;
  --accent: #6c5ce7;
  --accent-2: #8f7cf7;
  --gold: #f4c95d;
  --good: #2f9e6e;
  --bad: #d65a5a;
  --radius: 20px;
  --wood: #3fae6a; --fire: #e2574c; --earth: #d9a514; --metal: #8f9aa6; --water: #3557a6;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #2a2350; }
body {
  margin: 0;
  font-family: 'Noto Sans KR', system-ui, -apple-system, 'Apple SD Gothic Neo', sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 55%, var(--bg3) 100%) fixed;
  background-color: var(--bg1);
  min-height: 100vh;
  line-height: 1.65;
  word-break: keep-all;
}
body.has-timer { padding-bottom: 150px; }
.sky {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .7;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 8%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 85% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 40% 30%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 10% 45%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 60% 40%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 55%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 30% 65%, #fff 50%, transparent 51%);
}

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  max-width: 520px; margin: 0 auto; padding: 12px 16px;
  background: rgba(42, 35, 80, 0.75); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand { color: #fff; text-decoration: none; font-family: 'Gowun Dodum', sans-serif; font-size: 20px; letter-spacing: .5px; }
.back { width: 36px; height: 36px; border-radius: 12px; border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
.topbar-space { flex: 1; }

.app { position: relative; z-index: 1; max-width: 520px; margin: 0 auto; padding: 8px 16px 24px; }

/* 메뉴 */
.hero { color: #fff; text-align: center; padding: 22px 4px 10px; }
.hero h1 { font-family: 'Gowun Dodum', sans-serif; font-weight: 400; font-size: 26px; line-height: 1.4; margin: 0 0 10px; }
.hero p { margin: 0; opacity: .85; font-size: 14px; }
.group-title { color: #fff; font-family: 'Gowun Dodum', sans-serif; font-weight: 400; font-size: 20px; margin: 26px 4px 12px; display: flex; align-items: center; gap: 10px; }
.group-title::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.3); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tile {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 16px 6px 14px; border-radius: var(--radius); text-decoration: none; color: #fff;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.22);
  transition: transform .15s, background .15s;
}
.tile:active { transform: scale(.97); background: rgba(255,255,255,.2); }
.tile-ico {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; margin-bottom: 8px;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #ece7ff 60%, #d9cffc 100%); box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.tile b { font-size: 15px; font-weight: 700; }
.tile small { font-size: 11px; opacity: .8; line-height: 1.35; margin-top: 2px; }

/* 패널 */
.panel { position: relative; background: var(--panel); border-radius: 26px; padding: 26px 18px 22px; margin-top: 34px; box-shadow: 0 16px 40px rgba(20, 10, 60, .28); }
.panel-ico { position: absolute; top: -32px; left: 50%; transform: translateX(-50%); width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; background: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.panel h2 { text-align: center; font-family: 'Gowun Dodum', sans-serif; font-weight: 400; font-size: 22px; margin: 18px 0 6px; }
.intro { text-align: center; color: var(--ink-soft); font-size: 14px; margin: 0 0 16px; }

/* 폼 */
.form-sub { font-size: 16px; margin: 18px 0 2px; }
.form-sub::before { content: '• '; color: var(--accent); }
.hint { font-size: 12px; color: var(--ink-soft); margin: 0 0 10px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fields label { display: block; }
.fields label.full, .fields label.hour { grid-column: 1 / -1; }
.fields label > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fields input, .fields select {
  width: 100%; height: 50px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  padding: 0 12px; font: inherit; font-size: 15px; color: var(--ink); appearance: none; -webkit-appearance: none;
}
.fields select { background-image: linear-gradient(45deg, transparent 50%, #888 50%), linear-gradient(135deg, #888 50%, transparent 50%); background-position: calc(100% - 18px) 22px, calc(100% - 13px) 22px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
.fields input:focus, .fields select:focus { outline: 2px solid var(--accent-2); border-color: transparent; }
.agree { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; font-size: 14px; }
.agree span { flex: 1; line-height: 1.4; }
.agree input { flex: none; }
.agree .link-btn { flex: none; }
.fields + .agree, .fields ~ .agree:first-of-type { margin-top: 18px; }
.agree input { width: 20px; height: 20px; accent-color: var(--accent); }
.link-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 3px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.terms { font-size: 12px; color: var(--ink-soft); background: #f6f4fc; border-radius: 10px; padding: 10px 12px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin: 6px 0; }

.btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; border-radius: 14px; border: 0; font: inherit; font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 18px rgba(108, 92, 231, .35); }
.btn:disabled { background: #c9c4dc; box-shadow: none; cursor: default; }
.btn.coupang { background: #fff; color: #e52528; border: 2px solid #e52528; margin-top: 12px; }

/* 타로 */
.pick-count { text-align: center; font-weight: 700; color: var(--accent); margin: -6px 0 12px; }
.deck { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.card-back {
  aspect-ratio: 2 / 3; border-radius: 8px; border: 2px solid #fff; cursor: pointer; padding: 0;
  background:
    radial-gradient(circle at 50% 50%, transparent 30%, rgba(255,255,255,.18) 31%, transparent 34%),
    repeating-linear-gradient(45deg, #4b3f8f 0 6px, #5b4ea6 6px 12px);
  box-shadow: 0 3px 8px rgba(0,0,0,.15); transition: transform .2s, opacity .2s;
}
.card-back.picked { transform: translateY(-8px) scale(.94); opacity: .35; }

.spread { display: flex; justify-content: center; gap: 10px; margin: 6px 0 12px; }
.spread-item { flex: 1; max-width: 120px; text-align: center; }
.spread-item small { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }
.card-face {
  aspect-ratio: 2 / 3; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 8px 4px; color: #fff; border: 3px solid #fff; box-shadow: 0 6px 14px rgba(0,0,0,.2);
  background: linear-gradient(160deg, hsl(var(--h) 60% 55%), hsl(calc(var(--h) + 40) 55% 35%));
  animation: flip .6s ease;
}
.card-face.rev .cf-sym { transform: rotate(180deg); }
.cf-num { font-size: 12px; opacity: .9; }
.cf-sym { font-size: 34px; }
.cf-name { font-size: 12px; font-weight: 700; }
@keyframes flip { from { transform: rotateY(90deg); } to { transform: rotateY(0); } }

/* 광고 대기 */
.gate { text-align: center; padding-top: 30px; }
.gate h2 { font-size: 19px; }
.loader { display: flex; justify-content: center; gap: 6px; }
.loader span { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); animation: bounce 1s infinite; }
.loader span:nth-child(2) { animation-delay: .15s; } .loader span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-8px); opacity: 1; } }
.ad-box { background: #fafafe; border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.ad-frame { width: 100%; height: 280px; border: 0; border-radius: 10px; background: #fff; }
.ad-img { width: 100%; border-radius: 10px; display: block; }
.ad-placeholder { font-size: 56px; padding: 24px 0 6px; }
.timer-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  max-width: 520px; margin: 0 auto; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .97); border-radius: 20px 20px 0 0; box-shadow: 0 -8px 24px rgba(20, 10, 60, .18);
}
.timer-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.timer-track { flex: 1; height: 8px; border-radius: 8px; background: #ebe7f6; overflow: hidden; }
.timer-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--gold)); transition-property: width; transition-timing-function: linear; }
.timer-sec { font-weight: 700; font-size: 14px; color: var(--accent); min-width: 36px; text-align: right; }
.timer-btn { min-height: 48px; font-size: 15px; }
.disclosure { margin: 8px 0 0; font-size: 11px; line-height: 1.45; color: #8a86a0; text-align: center; }

/* 결과 */
.result { padding-top: 22px; }
.res-head { text-align: center; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.who { font-family: 'Gowun Dodum', sans-serif; font-size: 22px; }
.birth { font-size: 13px; color: var(--ink-soft); }
.chip { display: inline-block; margin-top: 10px; padding: 8px 18px; border-radius: 999px; background: #f0edfb; font-weight: 700; font-size: 15px; }
.tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.tabs button { flex: 1; max-width: 140px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: inherit; font-weight: 700; color: var(--ink-soft); cursor: pointer; }
.tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.score { padding: 18px 4px 6px; }
.score-bar { position: relative; height: 12px; border-radius: 12px; background: #ebe7f6; }
.score-fill { height: 100%; border-radius: 12px; background: linear-gradient(90deg, #a99bf5, var(--accent)); }
.score-num { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; background: var(--accent); border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,.2); }
.score-cap { text-align: center; font-size: 14px; color: var(--ink-soft); margin: 16px 0 4px; }
.kw { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.kw span { background: #f0edfb; color: var(--accent); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 700; }
.intensity { text-align: center; font-size: 14px; margin: 10px 0 0; }
.intensity small { color: var(--ink-soft); font-size: 11px; }
.stars { color: var(--gold); letter-spacing: 1px; font-size: 13px; }
.stars .dim { color: #ddd8ea; }

.res-sec { padding: 16px 2px 4px; border-top: 1px dashed var(--line); }
.res-sec:first-of-type { border-top: 0; }
.res-sec h3 { font-size: 17px; margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
.res-sec .ico { font-size: 18px; }
.res-sec p { margin: 0 0 8px; font-size: 15px; }
.note { font-size: 12px !important; color: var(--ink-soft); }

.lucky { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lucky li { background: #f7f5fd; border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.lucky b { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 500; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }

.months { list-style: none; padding: 0; margin: 0; }
.months li { padding: 10px 0; border-bottom: 1px solid #f1eef8; }
.months li:last-child { border-bottom: 0; }
.m-top { display: flex; align-items: center; gap: 8px; }
.m-top b { min-width: 64px; }
.m-score, .m-name { font-size: 13px; color: var(--accent); font-weight: 700; flex: 1; }
.months p { margin: 2px 0 0 !important; font-size: 14px !important; color: var(--ink-soft); }
.tag { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.tag-good { background: #e3f5ec; color: var(--good); } .tag-bad { background: #fbe7e7; color: var(--bad); } .tag-mid { background: #eeebf6; color: var(--ink-soft); }

.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.pcol { background: #f7f5fd; border-radius: 14px; padding: 8px 4px; }
.pcol.empty { opacity: .55; }
.plabel { font-size: 12px; color: var(--ink-soft); }
.pgod { font-size: 11px; color: var(--ink-soft); margin: 2px 0; }
.pcell { margin: 4px auto; width: 52px; height: 52px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; color: #fff; line-height: 1.1; }
.pcell small { font-size: 11px; font-weight: 400; opacity: .85; }
.pcell.el-wood { background: var(--wood); } .pcell.el-fire { background: var(--fire); } .pcell.el-earth { background: var(--earth); } .pcell.el-metal { background: var(--metal); } .pcell.el-water { background: var(--water); }
.el-bars { margin-top: 6px; }
.el-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; }
.el-name { width: 34px; font-weight: 700; }
.el-name.el-wood { color: var(--wood); } .el-name.el-fire { color: var(--fire); } .el-name.el-earth { color: var(--earth); } .el-name.el-metal { color: var(--metal); } .el-name.el-water { color: var(--water); }
.el-track { flex: 1; height: 10px; background: #efedf6; border-radius: 10px; overflow: hidden; }
.el-fill { height: 100%; border-radius: 10px; }
.el-fill.el-wood { background: var(--wood); } .el-fill.el-fire { background: var(--fire); } .el-fill.el-earth { background: var(--earth); } .el-fill.el-metal { background: var(--metal); } .el-fill.el-water { background: var(--water); }
.el-pct { width: 36px; text-align: right; color: var(--ink-soft); }
.yong, .psy, .career { padding-left: 0; list-style: none; margin: 0 0 8px; }
.yong li, .psy li, .career li { background: #f7f5fd; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; font-size: 14px; }
.yong b, .psy b, .career b { display: block; font-size: 13px; color: var(--accent); }
.shadow { display: block; color: var(--ink-soft); font-size: 13px; margin-top: 2px; }
.tbl-wrap { overflow-x: auto; }
.daeun { width: 100%; border-collapse: collapse; font-size: 13px; }
.daeun th { background: #f0edfb; font-weight: 700; padding: 8px 4px; }
.daeun td { border-bottom: 1px solid #f1eef8; padding: 8px 4px; vertical-align: top; }
.daeun td:nth-child(1), .daeun td:nth-child(2) { white-space: nowrap; text-align: center; }
.daeun td b { color: var(--accent); font-weight: 500; font-size: 12px; }
.daeun tr.cur td { background: #fff8e1; }
.gua { text-align: center; padding: 14px 0 4px; }
.gua-num { display: inline-grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; background: linear-gradient(135deg, #f4c95d, #e79a4b); color: #fff; font-size: 30px; font-weight: 700; box-shadow: 0 8px 18px rgba(231, 154, 75, .35); }
.gua-cap { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }

.res-actions { margin: 18px 0 0; }
.foot { position: relative; z-index: 1; max-width: 520px; margin: 0 auto; padding: 8px 16px 28px; color: rgba(255,255,255,.75); font-size: 11px; text-align: center; }
.foot p { margin: 2px 0; }

@media (max-width: 360px) {
  .tiles { gap: 8px; }
  .tile-ico { width: 54px; height: 54px; font-size: 26px; }
  .pcell { width: 44px; height: 44px; font-size: 18px; }
}

/* 상세 항목 */
.sub { background: #f7f5fd; border-radius: 12px; padding: 10px 12px; margin: 0 0 8px; }
.sub h4 { margin: 0 0 2px; font-size: 13px; color: var(--accent); }
.sub p { margin: 0 !important; font-size: 14px !important; }
.areas { background: #f7f5fd; border-radius: 14px; padding: 10px 12px; margin: 10px 0 6px; }
.area-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; }
.area-name { width: 58px; font-weight: 700; }
.area-track { flex: 1; height: 9px; background: #e6e1f4; border-radius: 9px; overflow: hidden; }
.area-fill { height: 100%; border-radius: 9px; background: linear-gradient(90deg, #b3a6f7, var(--accent)); }
.area-stars { flex: 1; }
.area-num { min-width: 52px; text-align: right; color: var(--accent); font-weight: 700; }
.caution { margin: 0; padding-left: 20px; }
.caution li { font-size: 14px; margin: 4px 0; }
.m-point { color: var(--ink) !important; }
.m-point b { display: inline-block; font-size: 11px; color: #fff; background: var(--accent-2); border-radius: 6px; padding: 0 6px; margin-right: 4px; }

.timer-msg { margin: 0 0 8px; font-size: 14px; font-weight: 700; text-align: center; color: var(--ink); }
.ad-title { margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.ad-link { display: block; }
.btn.ad-link { display: flex; }
.gate-step { margin: 14px 0 0; font-size: 13px; color: var(--accent); font-weight: 700; }
.btn.coupang { font-size: 17px; min-height: 56px; background: #e52528; color: #fff; border: 0; box-shadow: 0 8px 18px rgba(229, 37, 40, .3); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.02); } }

.notice-ad { margin: 8px 0 0; padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, .92); color: var(--ink); font-size: 13px; text-align: center; line-height: 1.5; box-shadow: 0 6px 16px rgba(20, 10, 60, .2); }
.notice-ad b { color: #e52528; }

/* 광고 4개 */
.disclosure-top { margin: 10px 0 0; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .9); color: #6b6785; font-size: 11px; line-height: 1.45; text-align: center; }
.free-msg { margin: 0 0 6px; text-align: center; font-size: 16px; font-weight: 700; color: var(--ink); }
.free-msg b { color: #e52528; }
.ad-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 14px; }
.ad-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; text-decoration: none; color: var(--ink); box-shadow: 0 4px 12px rgba(40, 20, 90, .08); }
.ad-card:active { transform: scale(.98); }
.ad-media { position: relative; aspect-ratio: 1 / 1; background: #f6f4fb; display: grid; place-items: center; }
.ad-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-mini-frame { width: 100%; height: 100%; border: 0; }
.ad-ph { font-size: 44px; }
.ad-badge { position: absolute; top: 6px; left: 6px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 6px; }
.ad-name { margin: 8px 10px 2px; font-size: 13px; font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 35px; }
.ad-go { margin: 0 10px 10px; font-size: 12px; font-weight: 700; color: #e52528; }

/* 타로 상세 */
.pos-intro { font-size: 13px !important; color: var(--ink-soft); margin: 0 0 6px !important; }
.kw.kw-left { justify-content: flex-start; margin: 0 0 10px; }
.res-sec.summary { background: #fff8e8; border-radius: 16px; padding: 14px 14px 6px; border-top: 0; margin-top: 12px; }

/* 상세 풀이 */
.caution-list { list-style: none; padding: 0; margin: 0 0 8px; }
.caution-list li { background: #fff4f2; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; font-size: 14px; }
.caution-list b { display: block; color: var(--bad); font-size: 13px; }
.quote { text-align: center; font-family: 'Gowun Dodum', sans-serif; font-size: 18px !important; color: var(--accent); padding: 8px 0; }
