:root {
  --bg: #0e0f1a;
  --card: #171a2b;
  --line: #2a2f48;
  --gold: #d4af37;
  --gold-2: #f0d060;
  --text: #ece6d2;
  --muted: #9aa3b8;
  --err: #fca5a5;
  --ok: #86efac;
  --wood: #4ade80; --fire: #f87171; --earth: #fbbf24; --metal: #e5e7eb; --water: #60a5fa;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: 15px; line-height: 1.7; -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: rgba(14, 15, 26, .94); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; letter-spacing: .02em; color: var(--gold); }
.pi-mark { display: inline-block; margin-left: 4px; padding: 0 7px; border: 1px solid var(--gold); border-radius: 999px; font-size: 13px; }
.who { font-size: 12px; color: var(--muted); max-width: 55%; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrap { max-width: 560px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 16px; }
.card h2 { margin: 0 0 8px; font-size: 17px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notice h2 { color: var(--gold); }
.hint { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.hint.small { font-size: 12px; align-self: end; margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.row.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
select {
  width: 100%; padding: 10px 8px; border-radius: 9px; border: 1px solid var(--line);
  background: #0f1222; color: var(--text); font-size: 15px;
}
.seg { display: inline-flex; }
.seg input, .check input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .check span {
  display: inline-block; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); cursor: pointer; font-size: 14px;
}
.seg input:checked + span, .check input:checked + span { border-color: var(--gold); color: var(--gold); background: rgba(212, 175, 55, .08); }
.seg input:focus-visible + span, .check input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.check { display: inline-flex; }
.err { min-height: 18px; color: var(--err); font-size: 13px; margin-bottom: 8px; }
.btn {
  appearance: none; border: 1px solid var(--line); background: #1e2238; color: var(--text);
  border-radius: 10px; padding: 12px 16px; font-size: 15px; font-weight: 700; cursor: pointer; width: 100%;
}
.btn.primary { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #1a1410; border: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .link:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.link { appearance: none; border: none; background: none; color: var(--gold); font-size: 13px; cursor: pointer; padding: 4px 0; }
.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin: 6px 0 12px; }
.pcol { border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; }
.pcol .pos { font-size: 11px; color: var(--muted); }
.pcol .tg { font-size: 11px; color: var(--muted); min-height: 16px; }
.pcol .ch { font-size: 22px; font-weight: 800; line-height: 1.25; }
.pcol .kr { font-size: 11px; color: var(--muted); }
.el-목 { color: var(--wood); } .el-화 { color: var(--fire); } .el-토 { color: var(--earth); } .el-금 { color: var(--metal); } .el-수 { color: var(--water); }
.wuxing { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 12px; }
.wx { text-align: center; font-size: 12px; color: var(--muted); }
.wx b { display: block; font-size: 18px; }
.typecard { border-top: 1px solid var(--line); padding-top: 12px; }
.typecard .tname { font-weight: 800; color: var(--gold); }
.typecard .tdesc { color: var(--muted); font-size: 13px; }
.plist { display: grid; gap: 10px; margin-bottom: 8px; }
.prod { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 8px; }
.prod .pname { font-weight: 800; }
.prod .pdesc { color: var(--muted); font-size: 13px; }
.prod .pmeta { font-size: 13px; color: var(--gold); }
.sec { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.sec:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.sec h3 { margin: 0 0 6px; font-size: 16px; color: var(--gold); text-wrap: balance; }
.sec p { margin: 0 0 10px; color: #ddd4be; max-width: 65ch; }
.ritem { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 10px 0; }
.ritem:first-child { border-top: none; }
.ritem small { color: var(--muted); }
.foot { max-width: 560px; margin: 8px auto 24px; padding: 0 16px; font-size: 11px; color: #6b7487; line-height: 1.6; }
.foot a { color: #8b93a7; }
.foot .links { margin-bottom: 6px; }
.test-note { margin-top: 6px; color: var(--gold); }
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(5, 6, 12, .78);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text);
}
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  max-width: min(92vw, 520px); background: #232843; border: 1px solid var(--line); color: var(--text);
  padding: 12px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
[hidden] { display: none !important; }
