:root {
  --night: #0d1636;
  --night-2: #18245a;
  --night-3: #24337a;
  --cream: #fff8ea;
  --cream-2: #f3e7cf;
  --ink: #2b2440;
  --ink-soft: #6b6283;
  --sun: #ffd66b;
  --sun-deep: #f5b83d;
  --peach: #ff9e7a;
  --mint: #8fe3c6;
  --lilac: #b9a6ff;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(5, 10, 35, .35);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font-head: "Jua", "Pretendard Variable", system-ui, sans-serif;
  --font-body: "Pretendard Variable", Pretendard, "Malgun Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  word-break: keep-all;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--cream);
  background: radial-gradient(1200px 700px at 80% -10%, #2c3d8f 0%, transparent 60%),
              radial-gradient(900px 600px at -10% 30%, #3a2a78 0%, transparent 55%),
              linear-gradient(180deg, var(--night) 0%, var(--night-2) 100%);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
a { color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; border-radius: 8px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(13, 22, 54, .72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; }
.brand em { font-style: normal; color: var(--sun); }
.brand-planet {
  width: 28px; height: 28px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 35% 30%, #fff3c4, var(--sun) 45%, var(--peach));
  box-shadow: 0 0 18px rgba(255, 214, 107, .6);
}
.brand-planet::after {
  content: ""; position: absolute; inset: 9px -7px; border: 2px solid rgba(255, 255, 255, .75);
  border-radius: 50%; transform: rotate(-20deg);
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  text-decoration: none; font-weight: 700; font-size: .95rem;
  padding: 8px 14px; border-radius: 999px; color: rgba(255, 248, 234, .78);
  transition: background .25s var(--ease), color .25s var(--ease);
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: var(--cream); }
.nav a.active { background: var(--sun); color: var(--ink); }

/* ---------- layout ---------- */
main { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 64px; outline: none; }
.page { animation: pageIn .6s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-top: 1.8em; }
h3 { font-size: 1.15rem; }
.lead { font-size: 1.1rem; color: rgba(255, 248, 234, .82); max-width: 640px; }
.crumbs { font-size: .9rem; color: rgba(255, 248, 234, .6); margin-bottom: 18px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--sun); }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(22px) scale(.98); transition: opacity .6s var(--ease), transform .6s var(--ease); transition-delay: calc(var(--i, 0) * 60ms); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1.2fr .8fr; align-items: center; gap: 24px; padding: 24px 0 8px; }
.hero h1 span { color: var(--sun); }
.hero-art { position: relative; aspect-ratio: 1; max-width: 340px; justify-self: center; width: 100%; }
.orbit { position: absolute; inset: 0; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .16); animation: spin 40s linear infinite; }
.orbit.o2 { inset: 14%; animation-duration: 26s; animation-direction: reverse; }
.orbit .moon { position: absolute; top: -9px; left: 50%; width: 18px; height: 18px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 14px var(--mint); }
.orbit.o2 .moon { background: var(--peach); box-shadow: 0 0 14px var(--peach); width: 14px; height: 14px; top: -7px; }
.planet {
  position: absolute; inset: 28%; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff6d1 0%, var(--sun) 30%, #ffb36b 60%, #e9786b 100%);
  box-shadow: inset -18px -22px 0 rgba(120, 40, 80, .18), 0 0 60px rgba(255, 196, 100, .45);
  animation: bob 6s ease-in-out infinite;
}
.planet::before { content: ""; position: absolute; width: 26%; height: 18%; left: 22%; top: 52%; border-radius: 50%; background: rgba(143, 227, 168, .85); }
.planet::after { content: ""; position: absolute; width: 18%; height: 14%; left: 58%; top: 26%; border-radius: 50%; background: rgba(143, 227, 168, .7); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ---------- cards ---------- */
.grid { display: grid; gap: 18px; }
.grid.g3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card {
  position: relative; display: block; text-decoration: none;
  background: var(--cream); color: var(--ink);
  border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
a.card:hover, button.card:hover { transform: translateY(-6px) rotate(-.4deg); box-shadow: 0 18px 40px rgba(5, 10, 35, .45); }
.card p { color: var(--ink-soft); margin: .3em 0 0; }
.card .go { position: absolute; right: 20px; bottom: 18px; font-weight: 800; color: var(--sun-deep); transition: transform .3s var(--ease); }
a.card:hover .go { transform: translateX(4px); }

.start-card { padding-bottom: 46px; }
.start-card .num {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 14px;
  font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; margin-bottom: 12px;
  background: var(--sun); color: var(--ink);
}
.start-card:nth-child(2) .num { background: var(--mint); }
.start-card:nth-child(3) .num { background: var(--lilac); }
.start-card:nth-child(4) .num { background: var(--peach); }

.cat-card { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.cat-card .ic { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; font-size: 1.4rem; background: var(--cream-2); flex: none; }
.cat-card.soon { opacity: .6; cursor: default; }
.cat-card.soon:hover { transform: none; }
.cat-card small { display: block; color: var(--ink-soft); font-weight: 700; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; vertical-align: middle; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.official { background: #dff5e9; color: #1f7a4c; }
.badge.community { background: #e5e9ff; color: #3b4fb8; }
.badge.unverified { background: #ffe9de; color: #b5532a; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: .9rem; color: rgba(255, 248, 234, .75); margin: 14px 0 0; }

/* ---------- facts strip ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 8px; }
.fact { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .09); border-radius: 18px; padding: 16px 18px; }
.fact b { display: block; font-family: var(--font-head); font-size: 1.15rem; color: var(--sun); }
.fact span { font-size: .92rem; color: rgba(255, 248, 234, .8); }

/* ---------- steps (beginner guide) ---------- */
.steps { list-style: none; padding: 0; margin: 24px 0 0; counter-reset: step; display: grid; gap: 16px; }
.step { display: grid; grid-template-columns: 52px 1fr; gap: 16px; align-items: start; }
.step::before {
  counter-increment: step; content: counter(step);
  width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 700; font-size: 1.3rem;
  background: var(--sun); color: var(--ink); box-shadow: 0 6px 18px rgba(255, 214, 107, .3);
}
.step .card { padding: 18px 20px; }
.step h3 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.callout { margin-top: 10px; padding: 10px 14px; border-radius: 14px; background: #fff0d1; color: #7a4d00; font-weight: 700; font-size: .95rem; }

/* ---------- galaxy compare ---------- */
.galaxy-card { overflow: hidden; padding: 0; }
.galaxy-top { position: relative; height: 170px; display: grid; place-items: center; background: var(--g1); overflow: hidden; }
.galaxy-top::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .55), transparent 55%); }
.g-planet { width: 96px; height: 96px; border-radius: 50%; background: radial-gradient(circle at 32% 28%, #fff, var(--g1) 35%, var(--g2)); box-shadow: inset -12px -14px 0 rgba(0, 0, 0, .12), 0 10px 30px rgba(0, 0, 0, .18); animation: bob 5s ease-in-out infinite; position: relative; }
.g-ring { position: absolute; width: 150px; height: 46px; border: 3px solid rgba(255, 255, 255, .8); border-radius: 50%; transform: rotate(-16deg); }
.galaxy-body { padding: 20px 22px 24px; }
.galaxy-body h3 { font-size: 1.6rem; margin-bottom: 2px; }
.kv { display: grid; grid-template-columns: 80px 1fr; gap: 8px 12px; margin: 14px 0 0; }
.kv dt { color: var(--ink-soft); font-weight: 700; font-size: .9rem; }
.kv dd { margin: 0; font-weight: 700; }

/* ---------- neighbors ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 22px 0 20px; }
.search {
  flex: 1 1 220px; min-width: 0; padding: 12px 16px 12px 42px; border-radius: 999px; border: 0;
  font: inherit; font-weight: 700; color: var(--ink); background: var(--cream) no-repeat 16px 50% / 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6283' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
}
.chip {
  border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: .9rem;
  padding: 9px 16px; border-radius: 999px; background: rgba(255, 255, 255, .1); color: var(--cream);
  transition: background .25s var(--ease), color .25s var(--ease), transform .2s var(--ease);
}
.chip:hover { background: rgba(255, 255, 255, .18); }
.chip:active { transform: scale(.95); }
.chip[aria-pressed="true"] { background: var(--sun); color: var(--ink); }

.n-card { text-align: center; padding: 22px 16px 20px; }
.avatar {
  --h: 30;
  width: 108px; height: 108px; margin: 0 auto 12px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 35% 30%, hsl(var(--h) 90% 92%), hsl(var(--h) 75% 78%));
  display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 0 0 5px #fff, 0 0 0 7px hsl(var(--h) 70% 80%);
  transition: transform .4s var(--ease);
}
.avatar .initial { font-family: var(--font-head); font-weight: 700; font-size: 2.6rem; color: hsl(var(--h) 45% 38%); }
.avatar img { position: absolute; inset: 6%; width: 88%; height: 88%; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(43, 36, 64, .18)); }
.avatar:has(img) .initial { visibility: hidden; }

.full-art {
  position: relative; margin: -6px -4px 6px; border-radius: 18px; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, hsl(var(--h) 90% 94%), hsl(var(--h) 70% 84%));
}
.full-art img { width: 100%; height: auto; animation: bob 6s ease-in-out infinite; }
a.n-card:hover .avatar { transform: translateY(-4px) rotate(-4deg) scale(1.04); }
.n-card h3 { margin: 0; }
.n-card .ko { color: var(--ink-soft); font-size: .85rem; font-weight: 700; }
.n-card .role { display: inline-block; margin-top: 8px; font-size: .82rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: var(--cream-2); color: var(--ink); }
.n-card .gx { display: block; margin-top: 8px; font-size: .8rem; color: var(--ink-soft); font-weight: 700; }
.empty { text-align: center; padding: 40px; color: rgba(255, 248, 234, .7); }

/* neighbor detail */
.detail { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
.detail .profile { text-align: center; padding: 28px 22px; }
.detail .avatar { width: 180px; height: 180px; }
.detail .avatar .initial { font-size: 4rem; }
.detail .profile h1 { color: var(--ink); font-size: 2.2rem; margin: 8px 0 0; }
.quote {
  position: relative; margin: 0; padding: 22px 24px 22px 56px; border-radius: var(--radius);
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1);
  font-size: 1.1rem; font-weight: 700;
}
.quote::before { content: "\201C"; position: absolute; left: 16px; top: 4px; font-family: var(--font-head); font-size: 3.6rem; color: var(--sun); line-height: 1; }
.quote cite { display: block; margin-top: 6px; font-size: .85rem; font-style: normal; font-weight: 600; color: rgba(255, 248, 234, .6); }
.info { margin-top: 18px; }
.info table { width: 100%; border-collapse: collapse; }
.info th, .info td { text-align: left; padding: 12px 4px; border-bottom: 1px solid var(--cream-2); vertical-align: top; }
.info th { width: 100px; color: var(--ink-soft); font-size: .9rem; }
.info tr:last-child th, .info tr:last-child td { border-bottom: 0; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
.pager a { text-decoration: none; font-weight: 800; padding: 10px 16px; border-radius: 999px; background: rgba(255, 255, 255, .08); transition: background .25s; }
.pager a:hover { background: rgba(255, 255, 255, .16); }
.shot-note { margin-top: 12px; font-size: .8rem; color: var(--ink-soft); }

/* ---------- codes ---------- */
.count { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; margin-left: 6px; border-radius: 999px; background: var(--sun); color: var(--ink); font-size: 1rem; vertical-align: middle; }
.code-list { display: grid; gap: 12px; }
.code-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 16px 20px; }
.code-main { display: flex; align-items: center; gap: 12px; }
.code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-weight: 700; font-size: 1.15rem; letter-spacing: .06em; padding: 6px 12px; border-radius: 10px; background: var(--cream-2); color: var(--ink); }
.copy { border: 0; cursor: pointer; font: inherit; font-weight: 800; padding: 8px 16px; border-radius: 999px; background: var(--ink); color: var(--cream); transition: transform .2s var(--ease), background .25s var(--ease); }
.copy:hover { transform: translateY(-2px); }
.copy.done { background: #1f7a4c; animation: pop .35s var(--ease); }
@keyframes pop { 50% { transform: scale(1.12); } }
.code-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--ink-soft); font-size: .92rem; }
.code-meta .rewards { color: var(--ink); font-weight: 700; }
.code-src { font-weight: 700; color: var(--ink-soft); }
.code-row.dead { opacity: .55; }
.code-row.dead .code { text-decoration: line-through; }
.how ul { margin: 6px 0 0; padding-left: 20px; color: var(--ink-soft); }
.how b { color: var(--ink); }
.empty-codes { display: flex; align-items: center; gap: 16px; }
.empty-codes .ic { font-size: 1.8rem; color: var(--sun-deep); animation: bob 3s ease-in-out infinite; }
.empty-codes p { margin: 0; }

/* ---------- report button ---------- */
.report-row { display: flex; justify-content: flex-end; margin-top: 16px; }
.report-btn {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  font-weight: 700; font-size: .9rem; padding: 8px 16px; border-radius: 999px;
  color: var(--cream); background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16);
  transition: background .25s var(--ease), transform .2s var(--ease);
}
.report-btn:hover { background: rgba(255, 214, 107, .2); transform: translateY(-2px); }

/* ---------- footer ---------- */
.footer { position: relative; z-index: 1; text-align: center; padding: 28px 16px 36px; font-size: .78rem; color: rgba(255, 248, 234, .5); border-top: 1px solid rgba(255, 255, 255, .06); }
.footer p { margin: 2px 0; }
.footer strong { color: rgba(255, 248, 234, .7); }
.footer a { color: rgba(255, 248, 234, .75); }

.src { font-size: .85rem; color: rgba(255, 248, 234, .6); margin-top: 26px; }
.src a { color: rgba(255, 248, 234, .8); }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { max-width: 220px; order: -1; }
  .detail { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
