/* 별별 작명소 — 밤하늘 · 금빛 무드 (별마마파파 브랜드) */

:root {
  --bg: #05060c;
  --bg-soft: #0a0c16;
  --line: rgba(245, 197, 66, 0.16);

  --gold-1: #ffe9a8;
  --gold-2: #f5c542;
  --gold-3: #d9a215;

  --text: #f6f6f8;
  --muted: #9aa1b0;
  --muted-dim: #6e7484;

  --kakao: #fee500;

  --maxw: 640px;
  --radius: 20px;

  --font-brand: "Gowun Batang", "Apple SD Gothic Neo", serif;
  --font-sub: "Gowun Dodum", "Apple SD Gothic Neo", sans-serif;
}

* { box-sizing: border-box; }

/* display 를 준 요소에도 hidden 이 듣게 한다 (모달·로딩이 flex 라서 필요) */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", system-ui, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  word-break: keep-all;
}

h1, h2, h3 { font-family: var(--font-brand); }

img { max-width: 100%; height: auto; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; border-radius: 8px; }

/* ── 배경 ─────────────────────────────────────── */

#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; pointer-events: none; }

.glow {
  position: fixed;
  top: -12vh; left: 50%;
  transform: translateX(-50%);
  width: min(140vw, 1000px);
  height: min(110vh, 900px);
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(245,197,66,0.13), rgba(245,197,66,0.04) 55%, transparent 72%);
}

/* ── 상단 ─────────────────────────────────────── */

.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 20px;
}
.nav__brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.nav__brand img { border-radius: 50%; }
.nav__brand span { font-family: var(--font-brand); font-weight: 700; letter-spacing: 0.02em; }

/* ── 히어로 ───────────────────────────────────── */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px 60px; }

.hero { text-align: center; padding: 18px 0 34px; }

/* ── 이름 글자로 만든 별자리 ──────────────────── */

.constel {
  position: relative;
  width: 100%;
  max-width: 330px;
  height: 132px;
  margin: 0 auto 6px;
}

.constel__lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.constel__lines polyline {
  fill: none;
  stroke: rgba(245, 197, 66, 0.34);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  animation: draw 2.4s ease-out 0.3s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.constel__g {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-brand);
  font-weight: 700;
  color: var(--gold-1);
  text-shadow: 0 0 18px rgba(245, 197, 66, 0.55);
  animation: twinkle 4.5s ease-in-out infinite;
}
.constel__g--1 { left: 9%;  top: 66%; font-size: 1.35rem; opacity: 0.7;  animation-delay: 0.2s; }
.constel__g--2 { left: 30%; top: 23%; font-size: 1.7rem;  opacity: 0.85; animation-delay: 1.1s; }
.constel__g--3 { left: 51%; top: 72%; font-size: 2.3rem;  opacity: 1;    animation-delay: 0.6s; }
.constel__g--4 { left: 71%; top: 28%; font-size: 1.6rem;  opacity: 0.8;  animation-delay: 1.6s; }
.constel__g--5 { left: 92%; top: 60%; font-size: 1.25rem; opacity: 0.65; animation-delay: 0.9s; }

@keyframes twinkle {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -54%) scale(1.06); }
}

.constel__spark {
  position: absolute;
  font-style: normal;
  color: var(--gold-2);
  text-shadow: 0 0 12px rgba(245, 197, 66, 0.8);
  animation: sparkFade 3.2s ease-in-out infinite;
}
.constel__spark--a { left: 20%; top: 8%;  font-size: 0.7rem; animation-delay: 0.4s; }
.constel__spark--b { left: 82%; top: 82%; font-size: 0.6rem; animation-delay: 1.8s; }
@keyframes sparkFade {
  0%, 100% { opacity: 0.15; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

@media (max-width: 400px) {
  .constel { height: 116px; }
  .constel__g--3 { font-size: 2rem; }
}

.hero__title {
  margin: 20px 0 0;
  font-size: clamp(1.9rem, 7vw, 2.6rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.rule { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px auto 18px; max-width: 200px; }
.rule__line { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(245,197,66,0.55), transparent); }
.rule__star { color: var(--gold-2); font-size: 0.72rem; }

.hero__sub { margin: 0; color: var(--muted); font-family: var(--font-sub); font-size: clamp(0.95rem, 3.6vw, 1.05rem); }

/* ── 카드 · 입력 ──────────────────────────────── */

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(245,197,66,0.06), rgba(255,255,255,0.015) 45%), rgba(10,12,22,0.72);
  padding: 8px 20px 26px;
}

.step { padding: 22px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.step:last-of-type { border-bottom: 0; }

.step__title {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 6px; font-size: 1.06rem; font-weight: 700;
}
.step__no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex: 0 0 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
  color: #14100a; font-size: 0.8rem; font-weight: 800;
  font-family: system-ui, sans-serif;
}
.tag-opt {
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid rgba(154,161,176,0.4);
  color: var(--muted); font-size: 0.7rem; font-weight: 600;
}
.step__hint { margin: 0 0 14px; color: var(--muted-dim); font-family: var(--font-sub); font-size: 0.87rem; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 460px) { .grid2 { grid-template-columns: 1fr; } }

.field { display: block; }
.field__label { display: block; margin-bottom: 6px; font-size: 0.85rem; color: var(--muted); font-family: var(--font-sub); }
.field__opt { font-style: normal; font-size: 0.78rem; color: var(--muted-dim); }

/* 이름 칸마다 붙는 '아이 성으로' 고르기 */
.pfield { display: flex; flex-direction: column; }
.surtick { margin-top: 8px; cursor: pointer; user-select: none; }
.surtick input { position: absolute; opacity: 0; pointer-events: none; }
.surtick span {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-sub);
  font-size: 0.82rem;
  color: var(--muted-dim);
  transition: color 0.15s ease;
}
.surtick__box {
  width: 17px; height: 17px; flex: none;
  border: 1px solid rgba(245, 197, 66, 0.4);
  border-radius: 5px;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.surtick__box::after {
  content: "";
  position: absolute; left: 5px; top: 1px;
  width: 4px; height: 9px;
  border-right: 2px solid #14100a;
  border-bottom: 2px solid #14100a;
  transform: rotate(45deg) scale(0.6);
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.surtick input:checked + span { color: var(--gold-1); }
.surtick input:checked + span .surtick__box {
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2));
  border-color: var(--gold-2);
}
.surtick input:checked + span .surtick__box::after { opacity: 1; transform: rotate(45deg) scale(1); }
.surtick span b { font-weight: 700; color: var(--gold-1); }
.surtick input:focus-visible + span .surtick__box { outline: 2px solid var(--gold-2); outline-offset: 2px; }

/* 이름을 안 적으면 그쪽 성은 고를 수 없다 */
.surtick.is-off { cursor: not-allowed; }
.surtick.is-off span { opacity: 0.38; }

input[type="text"], select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
input[type="text"]::placeholder { color: var(--muted-dim); }
input[type="text"]:focus, select:focus { border-color: rgba(245,197,66,0.5); }

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold-2) 50%), linear-gradient(135deg, var(--gold-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px;
}
select option { background: #12131c; color: var(--text); }

/* ── 한자 고르기 ──────────────────────────────── */

.hanja-pick { margin-top: 20px; padding-top: 18px; border-top: 1px dashed rgba(245,197,66,0.2); }
.hanja-rows { display: flex; flex-direction: column; gap: 14px; }

.hrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hrow__custom {
  flex: 1 1 100%;
  margin-left: 116px;
  min-height: 42px !important;
  font-size: 0.92rem !important;
  border-color: rgba(245,197,66,0.4) !important;
}
.hrow__note {
  flex: 1 1 100%;
  margin: -2px 0 0;
  margin-left: 116px;
  font-family: var(--font-sub);
  font-size: 0.78rem;
  line-height: 1.5;
}
.hrow__note.is-ok { color: var(--gold-2); }
.hrow__note.is-warn { color: #ffc9a0; }
@media (max-width: 460px) {
  .hrow__custom, .hrow__note { margin-left: 0; }
}
.hrow__who {
  flex: 0 0 auto; min-width: 62px;
  font-family: var(--font-sub); font-size: 0.78rem; color: var(--muted-dim);
}
.hrow__syl {
  flex: 0 0 42px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(245,197,66,0.07);
  font-family: var(--font-brand);
  font-size: 1.2rem; font-weight: 700; color: var(--gold-1);
}
.hrow select { flex: 1; min-width: 0; }

/* ── 유사도 ───────────────────────────────────── */

input[type="range"] {
  width: 100%;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(245,197,66,0.7), rgba(245,197,66,0.18));
  margin: 6px 0 4px;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-3));
  box-shadow: 0 0 14px rgba(245,197,66,0.5);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px; border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-3));
  cursor: pointer;
}

.simil { display: flex; align-items: baseline; gap: 12px; margin-top: 8px; }
.simil__pct { font-family: var(--font-brand); font-size: 1.35rem; font-weight: 700; color: var(--gold-2); flex: 0 0 auto; }
.simil__desc { margin: 0; color: var(--muted); font-family: var(--font-sub); font-size: 0.87rem; }

/* ── 선택지 ───────────────────────────────────── */

.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opts--3 { grid-template-columns: repeat(3, 1fr); }

.opt { position: relative; display: block; cursor: pointer; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt span {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  min-height: 58px; padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
  font-size: 0.95rem; font-weight: 600;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.opt span em {
  font-style: normal; font-family: var(--font-sub);
  font-size: 0.72rem; font-weight: 400; color: var(--muted-dim);
}
/* 닮음을 고를 수 없을 때(부모 이름 없음) */
.step.is-off #simil { opacity: 0.4; cursor: not-allowed; }
.step.is-off .simil__pct { opacity: 0.5; }

.opt input:checked + span {
  border-color: rgba(245,197,66,0.6);
  background: rgba(245,197,66,0.11);
  color: var(--gold-1);
  transform: translateY(-1px);
}
.opt input:checked + span em { color: rgba(255,233,168,0.75); }
.opt input:focus-visible + span { outline: 2px solid var(--gold-2); outline-offset: 2px; }

.must-box { margin-top: 14px; }

/* 더 자세히 고르기 — 눌러 볼 것이 있다는 걸 한눈에 알도록 상자로 세운다 */
.more { margin-top: 20px; }
.more > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  cursor: pointer;
  list-style: none;
  border: 1px solid rgba(245, 197, 66, 0.28);
  border-radius: 14px;
  background: transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.more > summary:hover {
  border-color: rgba(245, 197, 66, 0.5);
  background: rgba(255, 255, 255, 0.02);
}
.more > summary::-webkit-details-marker { display: none; }

.more__icon {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(245, 197, 66, 0.28);
  color: var(--gold-2);
  font-size: 0.82rem;
}
.more__text {
  flex: 1;
  min-width: 0;
  font-family: var(--font-brand);
  font-size: 1.02rem;
  color: var(--gold-1);
}
.more__text em {
  display: block;
  margin-top: 3px;
  font-family: var(--font-sub);
  font-style: normal;
  font-size: 0.76rem;
  color: var(--muted-dim);
}
.more__chev {
  flex: none;
  width: 9px; height: 9px;
  border-right: 2px solid var(--gold-2);
  border-bottom: 2px solid var(--gold-2);
  transform: translateY(-3px) rotate(45deg);
  transition: transform 0.22s ease;
}
.more[open] > summary {
  border-color: rgba(245, 197, 66, 0.28);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.more[open] .more__chev { transform: translateY(1px) rotate(-135deg); }
/* 펼치면 상자가 아래 내용까지 이어지도록 테두리를 둘러 준다 */
.more[open] > summary ~ .step {
  border-left: 1px solid rgba(245, 197, 66, 0.2);
  border-right: 1px solid rgba(245, 197, 66, 0.2);
  padding-left: 16px;
  padding-right: 16px;
}
.more[open] > summary ~ .step:last-of-type {
  border-bottom: 1px solid rgba(245, 197, 66, 0.2);
  border-radius: 0 0 14px 14px;
  padding-bottom: 18px;
}
.more .step { padding-top: 4px; }
.more .step:first-of-type { border-top: 0; }
.more .step__title { font-size: 1rem; }

/* ── 버튼 ─────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 26px;
  border: 0; border-radius: 999px;
  font-family: inherit; font-size: 1rem; font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn--big { width: 100%; margin-top: 22px; min-height: 58px; font-size: 1.06rem; }
.btn--gold {
  background: linear-gradient(135deg, var(--gold-1), var(--gold-2) 55%, var(--gold-3));
  color: #14100a;
  box-shadow: 0 10px 28px rgba(245,197,66,0.22);
}
.btn--gold:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(245,197,66,0.32); }
.btn--ghost {
  border: 1px solid var(--line);
  color: var(--gold-1);
  background: rgba(255,255,255,0.02);
}
.btn--ghost:hover { transform: translateY(-2px); background: rgba(245,197,66,0.08); }
.btn--kakao { background: var(--kakao); color: #3c1e1e; }
.btn--kakao:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(254,229,0,0.25); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.form-error {
  margin: 16px 0 0; padding: 12px 14px;
  border: 1px solid rgba(255,120,120,0.35);
  border-radius: 12px;
  background: rgba(255,90,90,0.08);
  color: #ffb4b4;
  font-family: var(--font-sub); font-size: 0.88rem;
}

.foot-note {
  margin: 20px 4px 0;
  color: var(--muted-dim);
  font-family: var(--font-sub); font-size: 0.8rem; text-align: center;
}
.foot-note a { color: var(--muted); }

/* ── 읽을거리 ─────────────────────────────────── */

.info { padding: 46px 4px 0; }
.info__title {
  margin: 0 0 6px;
  font-size: 1.3rem; font-weight: 700;
  color: var(--gold-1);
  text-align: center;
}
.info__lead {
  margin: 0 auto 22px;
  max-width: 440px;
  color: var(--muted);
  font-family: var(--font-sub); font-size: 0.9rem;
  text-align: center;
}

.steps { margin: 22px 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps li {
  position: relative;
  padding: 0 0 20px 42px;
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 1px;
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(245,197,66,0.08);
  color: var(--gold-2);
  font-size: 0.78rem; font-weight: 700;
  font-family: system-ui, sans-serif;
}
.steps li:not(:last-child)::after {
  content: "";
  position: absolute; left: 13px; top: 32px; bottom: 8px;
  width: 1px;
  background: linear-gradient(180deg, rgba(245,197,66,0.28), transparent);
}
.steps h3 { margin: 2px 0 4px; font-size: 1rem; font-weight: 700; }
.steps p { margin: 0; color: var(--muted); font-family: var(--font-sub); font-size: 0.88rem; }
.steps b { color: var(--gold-1); font-weight: 600; }

.samples { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 460px) { .samples { grid-template-columns: 1fr; } }

.sample {
  padding: 22px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(245,197,66,0.06), rgba(255,255,255,0.015) 45%), rgba(10,12,22,0.6);
  text-align: center;
}
.sample__hanja {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 2rem; font-weight: 700; letter-spacing: 0.1em;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sample__name { margin: 2px 0 0; font-size: 1.1rem; font-weight: 700; letter-spacing: 0.04em; }
.sample__chars {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px;
  margin: 12px 0 0;
  font-family: var(--font-sub); font-size: 0.82rem; color: var(--muted-dim);
}
.sample__chars i { font-style: normal; font-family: var(--font-brand); color: var(--gold-2); }
.sample__meaning {
  margin: 12px 0 0; padding-top: 11px;
  border-top: 1px solid rgba(245,197,66,0.18);
  font-family: var(--font-brand); font-size: 0.98rem; color: var(--gold-1);
}

.qa {
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
  margin-bottom: 9px;
}
.qa summary {
  padding: 15px 44px 15px 16px;
  position: relative;
  cursor: pointer;
  font-size: 0.94rem; font-weight: 600;
  list-style: none;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after {
  content: "+";
  position: absolute; right: 17px; top: 50%;
  transform: translateY(-50%);
  color: var(--gold-2); font-size: 1.15rem; font-weight: 400;
}
.qa[open] summary::after { content: "−"; }
.qa[open] summary { color: var(--gold-1); }
.qa p {
  margin: 0; padding: 0 16px 16px;
  color: var(--muted);
  font-family: var(--font-sub); font-size: 0.88rem;
}
.qa a { color: var(--gold-2); }
.qa b { color: var(--gold-1); font-weight: 600; }

/* ── 푸터 ─────────────────────────────────────── */

.footer { padding: 40px 20px 56px; text-align: center; border-top: 1px solid rgba(255,255,255,0.06); }
.footer img { border-radius: 50%; opacity: 0.85; transition: opacity 0.2s ease; }
.footer__link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 6px 14px 4px;
  border-radius: 14px;
  transition: background 0.2s ease;
}
.footer__link:hover { background: rgba(245,197,66,0.07); }
.footer__link:hover img { opacity: 1; }
.footer__link:hover .footer__brand { color: var(--gold-2); }
.footer__brand {
  font-family: var(--font-brand); font-weight: 700;
  letter-spacing: 0.06em; color: var(--gold-1);
  transition: color 0.2s ease;
}
.footer__copy { margin: 6px 0 0; color: var(--muted-dim); font-family: var(--font-sub); font-size: 0.8rem; }

/* ── 로딩 ─────────────────────────────────────── */

.loading {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 40px;
  background: rgba(5,6,12,0.93);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.orbit { position: relative; width: 150px; height: 150px; }
.orbit__core {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1rem; color: var(--gold-2);
  text-shadow: 0 0 26px rgba(245,197,66,0.75);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 0.85; } 50% { transform: scale(1.22); opacity: 1; } }

.orbit__ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(245,197,66,0.15); }
.orbit__ring i {
  position: absolute; top: -9px; left: 50%;
  margin-left: -9px;
  font-size: 1rem; font-style: normal; color: var(--gold-1);
  text-shadow: 0 0 12px rgba(245,197,66,0.8);
}
.orbit__ring--1 { animation: spin 2.6s linear infinite; }
.orbit__ring--2 { inset: 22px; animation: spin 3.6s linear infinite reverse; }
.orbit__ring--3 { inset: 44px; animation: spin 2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading__text {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 1.1rem; color: var(--gold-1);
  letter-spacing: 0.02em;
  animation: breathe 1.6s ease-in-out infinite;
}
@keyframes breathe { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }

/* ── 모달 ─────────────────────────────────────── */

.modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal__dim { position: absolute; inset: 0; background: rgba(3,4,9,0.82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fadeIn 0.3s ease; }

.modal__box {
  position: relative;
  width: 100%; max-width: 430px;
  max-height: 90vh; overflow-y: auto;
  padding: 34px 26px 26px;
  border: 1px solid rgba(245,197,66,0.3);
  border-radius: 26px;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(245,197,66,0.16), transparent 60%),
    linear-gradient(170deg, #0d0f1a, #07080f);
  box-shadow: 0 30px 80px rgba(0,0,0,0.65), 0 0 60px rgba(245,197,66,0.13);
  text-align: center;
  animation: popIn 0.5s cubic-bezier(0.2, 1.2, 0.4, 1);
}
@keyframes popIn {
  0% { opacity: 0; transform: scale(0.82) translateY(16px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.modal__x {
  position: absolute; top: 12px; right: 14px;
  width: 34px; height: 34px;
  border: 0; border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: var(--muted); font-size: 0.85rem; cursor: pointer;
}
.modal__x:hover { background: rgba(255,255,255,0.12); color: var(--text); }

.modal__tada { margin: 0 0 4px; font-family: var(--font-sub); font-size: 0.9rem; color: var(--gold-2); }

.modal__starburst { position: relative; height: 22px; }
.modal__starburst span {
  position: absolute; top: 0;
  font-size: 0.8rem; color: var(--gold-1);
  opacity: 0;
  animation: sparkle 1.5s ease-out forwards;
}
.modal__starburst span:nth-child(1) { left: 16%; animation-delay: 0.18s; }
.modal__starburst span:nth-child(2) { left: 33%; animation-delay: 0.34s; font-size: 0.65rem; }
.modal__starburst span:nth-child(3) { left: 50%; animation-delay: 0.1s; font-size: 0.95rem; }
.modal__starburst span:nth-child(4) { left: 67%; animation-delay: 0.42s; font-size: 0.7rem; }
.modal__starburst span:nth-child(5) { left: 83%; animation-delay: 0.26s; }
@keyframes sparkle {
  0% { opacity: 0; transform: translateY(10px) scale(0.4); }
  45% { opacity: 1; transform: translateY(-4px) scale(1.15); }
  100% { opacity: 0; transform: translateY(-16px) scale(0.7); }
}

.modal__hanja {
  margin: 6px 0 0;
  font-family: var(--font-brand);
  font-size: clamp(2.4rem, 12vw, 3.2rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(245,197,66,0.2);
}
.modal__hanja:empty { display: none; }

.modal__name {
  margin: 4px 0 0;
  font-size: clamp(1.6rem, 8vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
}
.modal__hanja:empty + .modal__name {
  font-size: clamp(2.4rem, 12vw, 3.2rem);
  background: linear-gradient(180deg, var(--gold-1), var(--gold-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-top: 10px;
}

.modal__meaning {
  margin: 12px auto 0;
  padding-top: 14px;
  border-top: 1px solid rgba(245,197,66,0.18);
  max-width: 320px;
  font-family: var(--font-brand);
  font-size: 1.06rem;
  color: var(--gold-1);
  line-height: 1.6;
}
.modal__meaning:empty { display: none; }

/* 글자마다 "보배 진 珍" */
.modal__chars {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  margin: 18px 0 0;
}
.modal__chars:empty { display: none; }
.modal__chars .ch {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-sub);
  font-size: 0.95rem;
  color: var(--muted);
  white-space: nowrap;
}
.modal__chars .ch i {
  font-style: normal;
  font-family: var(--font-brand);
  font-size: 1.12rem;
  color: var(--gold-2);
}

.modal__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.modal__actions .btn { min-height: 50px; padding: 0 12px; font-size: 0.95rem; }

.modal__note { margin: 12px 0 0; min-height: 18px; font-family: var(--font-sub); font-size: 0.78rem; color: var(--muted-dim); }

.modal__reset {
  display: block;
  margin: 10px auto 0;
  padding: 7px 15px;
  font-family: var(--font-sub); font-size: 0.78rem;
  color: var(--gold-1);
  background: transparent;
  border: 1px solid rgba(245, 197, 66, 0.34);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.modal__reset:hover { border-color: rgba(245, 197, 66, 0.7); background: rgba(245, 197, 66, 0.08); }

/* ── 토스트 ───────────────────────────────────── */

.toast {
  position: fixed; left: 50%; bottom: 34px;
  transform: translateX(-50%);
  z-index: 90;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(18,19,28,0.96);
  color: var(--gold-1);
  font-family: var(--font-sub); font-size: 0.88rem;
  box-shadow: 0 12px 34px rgba(0,0,0,0.5);
  animation: toastIn 0.28s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ── 반응형 · 모션 ────────────────────────────── */

@media (min-width: 561px) { .br-m { display: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
