/* 글꼴은 프리텐다드만 씁니다 (OFL 무료 글꼴). 화면에 쓰인 한글 글자만 나눠 받아 가볍습니다. */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root { color-scheme:dark;
  --bg:#0d1714; --fg:#e7f5ec; --muted:#a9cdb8; --line:rgba(95,211,141,.28); --card:rgba(14,30,24,.62); --field:rgba(6,16,12,.72);
  --accent:#5fd38d; --accent-2:#3fbf74; --on-accent:#06130c; }
* { box-sizing:border-box; }
body { margin:0; min-height:100vh; color:var(--fg); background:#0d1714; word-break:keep-all; -webkit-font-smoothing:antialiased;
  /* 뒤쪽 글꼴은 프리텐다드를 못 불러왔을 때만 쓰입니다 */
  font:16px/1.6 "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }

/* 숲 배경: 휴대폰에서도 고정되도록 body 배경 대신 고정된 층에 깝니다 */
body::before { content:""; position:fixed; inset:0; z-index:-2;
  background:linear-gradient(180deg, rgba(8,18,14,.45), rgba(8,18,14,.78)), url("assets/bg-desktop.jpg") center / cover no-repeat, #0d1714; }
@media (max-aspect-ratio: 1/1) {
  body::before { background:linear-gradient(180deg, rgba(8,18,14,.4), rgba(8,18,14,.8)), url("assets/bg-mobile.jpg") center / cover no-repeat, #0d1714; }
}

/* 떠다니는 반딧불 */
.fireflies { position:fixed; inset:0; z-index:-1; overflow:hidden; pointer-events:none; }
.fireflies i { position:absolute; left:var(--x); top:var(--y); width:5px; height:5px; border-radius:50%;
  background:#c8ffb0; box-shadow:0 0 10px 3px rgba(170,255,150,.55); opacity:0;
  animation:float var(--d, 9s) ease-in-out var(--w, 0s) infinite; }
@keyframes float {
  0% { transform:translate(0, 0); opacity:0; }
  20% { opacity:.9; }
  50% { transform:translate(14px, -36px); opacity:.5; }
  80% { opacity:.85; }
  100% { transform:translate(-8px, -70px); opacity:0; }
}

a { color:var(--accent); }
:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }
img { max-width:100%; }

header, main, footer { max-width:620px; margin:0 auto; padding-left:16px; padding-right:16px; }
header { display:flex; align-items:center; height:52px; }
.logo { display:inline-flex; align-items:center; gap:8px; color:var(--fg); text-decoration:none; font-weight:700; font-size:16px; letter-spacing:-0.01em; }
.logo img { width:30px; height:30px; border-radius:8px; }
main { padding-top:8px; padding-bottom:40px; }
footer { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:4px 20px;
  padding-top:20px; padding-bottom:40px; border-top:1px solid var(--line); color:var(--muted); font-size:14px; }
footer > * { padding:4px 0; line-height:1.4; }
footer a { color:var(--muted); }

h1 { font-size:32px; font-weight:800; line-height:1.25; letter-spacing:-0.03em; margin:0 0 20px; text-shadow:0 2px 16px rgba(0,0,0,.5); }
h2 { font-size:20px; margin:32px 0 8px; }
.center { text-align:center; }
.note { min-height:1.6em; margin:8px 0 0; font-size:14px; color:var(--muted); }

/* 화면 로고 + 제목 */
.hero { display:flex; flex-direction:column; align-items:center; text-align:center; margin:8px 0 20px; }
.hero-logo { width:120px; height:120px; margin-bottom:4px; filter:drop-shadow(0 0 18px rgba(95,211,141,.35)); }
.eyebrow { margin:0 0 6px; font-size:12px; font-weight:700; letter-spacing:.24em; color:var(--accent); }
.hero h1 { margin:0; }
.hl { background:linear-gradient(90deg, #5fd38d, #c4f7d8); -webkit-background-clip:text; background-clip:text; color:transparent; }

/* 유리처럼 비치는 카드 */
.card { background:var(--card); border:1px solid var(--line); border-radius:18px; padding:20px;
  -webkit-backdrop-filter:blur(14px) saturate(120%); backdrop-filter:blur(14px) saturate(120%);
  box-shadow:0 12px 40px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.06); }

.form { display:flex; flex-direction:column; gap:14px; }
.lbl { display:block; margin:0 0 6px; color:var(--accent); font-weight:600; font-size:13px; line-height:1.2; }
input { width:100%; min-height:44px; font:inherit; font-size:16px; /* 16px 미만이면 아이폰이 입력할 때 화면을 확대합니다 */ color:var(--fg); background-color:var(--field);
  border:1px solid var(--line); border-radius:12px; padding:8px 12px; transition:border-color .15s, box-shadow .15s; }
input:hover { border-color:rgba(95,211,141,.5); }
input:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(95,211,141,.22); }
input::placeholder { color:rgba(169,205,184,.6); }
/* 욕설·비속어 경고: 옅은 빨간색 */
input.bad, input.bad:focus { border-color:rgba(255,128,128,.75); box-shadow:0 0 0 3px rgba(255,128,128,.18); }
.note.warn { color:#ff9e9e; }
/* 닉네임 자리에 경고를 보여 줄 때: 닉네임과 같은 높이를 유지하고 그 가운데에 작은 글씨로 */
.nick-result.warning { display:flex; align-items:center; justify-content:center; white-space:pre-line; cursor:default;
  min-height:calc(min(60px, (100cqw - 8px) / 3) * 1.2); font-size:15px; font-weight:600; line-height:1.5;
  color:#ff9e9e; text-shadow:none; animation:none; }

/* 칩: 진짜 라디오 버튼은 숨기고 옆의 라벨을 동그란 칩으로 꾸밉니다 */
.chips { display:flex; flex-wrap:wrap; gap:6px; }
.opt { position:relative; flex:none; }
.opt input { position:absolute; opacity:0; width:1px; height:1px; min-height:0; padding:0; }
.chip { display:inline-flex; align-items:baseline; gap:5px; min-height:38px; padding:9px 14px; border-radius:999px; cursor:pointer;
  border:1px solid var(--line); background:var(--field); color:var(--fg); font-size:14px; font-weight:600; line-height:1.4; white-space:nowrap;
  transition:background .2s, color .2s, border-color .2s, box-shadow .2s, transform .12s; }
.chip small { font-size:11px; font-weight:500; color:var(--muted); transition:color .2s; }
.chip:hover { border-color:rgba(95,211,141,.55); }
.chip:active { transform:scale(.95); }
.opt input:checked + .chip { border-color:transparent; color:var(--on-accent);
  background:linear-gradient(135deg, #78e8a5, var(--accent-2)); box-shadow:0 4px 16px rgba(95,211,141,.35); }
.opt input:checked + .chip small { color:rgba(6,19,12,.7); }
.opt input:focus-visible + .chip { outline:3px solid var(--accent); outline-offset:2px; }
.opt input:disabled + .chip { opacity:.4; cursor:not-allowed; transform:none; }
/* 타입 칩: 휴대폰에선 한 줄로 두고 옆으로 넘겨서 고릅니다 (스크롤 막대는 숨기고 ‹ › 버튼으로 넘김) */
.chips.scroll { flex-wrap:nowrap; overflow-x:auto; scroll-snap-type:x proximity;
  margin:0 -20px; padding:2px 20px; scroll-padding:0 20px; scrollbar-width:none; }
.chips.scroll::-webkit-scrollbar { display:none; }
/* 타입 두 칸: 왼쪽에 줄 이름(무작위/명사), 오른쪽에 그 줄의 칩.
   칩은 같은 너비로 줄을 꽉 채워 정렬하고(넘기기 없음), 이름 아래에 글자 수 범위를 둡니다. */
.type-rows { display:flex; flex-direction:column; gap:6px; }
.trow { display:flex; align-items:center; gap:8px; }
.tlabel { flex:none; width:42px; color:var(--accent); font-size:13px; font-weight:700; line-height:1.2; }
.tgrid { flex:1; min-width:0; display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0, 1fr); gap:6px; }
.tgrid .opt { min-width:0; }
.tgrid .chip { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:0; width:100%;
  min-height:0; padding:5px 2px; border-radius:12px; font-size:14px; line-height:1.2; overflow:hidden; }
.tgrid .chip small { font-size:11px; line-height:1.2; }
/* 양끝 ‹ › 넘기기 버튼 */
.scroller { position:relative; }
.sarrow { position:absolute; top:2px; z-index:2; width:34px; height:38px; min-height:0; padding:0; border:0; border-radius:999px; cursor:pointer;
  display:flex; align-items:center; justify-content:center; font:inherit; font-size:24px; line-height:1; color:var(--accent);
  background:rgba(8,20,15,.95); box-shadow:0 0 14px 10px rgba(8,20,15,.92); transition:transform .12s; }
.sarrow:active { transform:scale(.9); }
.sarrow.prev { left:-6px; }
.sarrow.next { right:-6px; }
.sarrow[hidden] { display:none; }
.chips.scroll .opt { scroll-snap-align:start; }
/* 타입을 바꾸면 새 글자 수 칩이 차례로 나타납니다 */
.chips.enter .opt { animation:chipIn .3s ease both; }
.chips.enter .opt:nth-child(2) { animation-delay:.03s; } .chips.enter .opt:nth-child(3) { animation-delay:.06s; }
.chips.enter .opt:nth-child(4) { animation-delay:.09s; } .chips.enter .opt:nth-child(5) { animation-delay:.12s; }
.chips.enter .opt:nth-child(6) { animation-delay:.15s; } .chips.enter .opt:nth-child(7) { animation-delay:.18s; }
@keyframes chipIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
/* 필수 글자 칸 옆의 위치 칩 */
.kw-row { display:flex; gap:8px; align-items:center; }
.kw-row input { flex:1; min-width:0; }
.chips.pos { flex-wrap:nowrap; gap:4px; }
.chips.pos .chip { min-height:44px; padding:11px 11px; font-size:13px; }

/* 결과: 닉네임은 항상 한 줄. 글자 수(--n, index.html에서 넣음)에 맞춰 카드 폭 안으로 글씨를 줄입니다. */
.result { margin-top:16px; padding-top:14px; border-top:1px solid var(--line); text-align:center; container-type:inline-size; }
.nick-result { display:block; width:100%; min-height:1.2em; padding:0; border:none; background:none; cursor:pointer;
  color:var(--accent); font:inherit; font-weight:800; line-height:1.2; letter-spacing:-0.02em; white-space:nowrap;
  font-size:min(60px, calc((100cqw - 8px) / var(--n, 3))); text-shadow:0 0 24px rgba(95,211,141,.45); }
.nick-result.pop { animation:pop .35s cubic-bezier(.2, .9, .3, 1.25); }
@keyframes pop { from { transform:scale(.9); opacity:0; } to { transform:none; opacity:1; } }

/* 빛나는 생성 버튼 */
.generate { display:block; width:100%; max-width:360px; min-height:52px; margin:16px auto 0; border:0; border-radius:14px; cursor:pointer;
  background:linear-gradient(135deg, #78e8a5, var(--accent-2)); color:var(--on-accent); font:inherit; font-size:18px; font-weight:800;
  box-shadow:0 8px 28px rgba(95,211,141,.38), inset 0 1px 0 rgba(255,255,255,.35); transition:transform .1s, filter .15s, box-shadow .15s; }
.generate:hover { filter:brightness(1.06); box-shadow:0 10px 34px rgba(95,211,141,.5), inset 0 1px 0 rgba(255,255,255,.35); }
.generate:active { transform:scale(.97); }

/* 첫 화면: 생성기만 화면 높이를 꽉 채웁니다 */
.stage { min-height:100vh; min-height:100svh; display:flex; flex-direction:column; justify-content:center; padding-bottom:24px; }

/* 광고: 승인 후 이 칸에 광고 코드를 넣습니다. 비어 있으면 숨기고, 넣으면 높이를 미리 잡아 화면이 밀리지 않게 합니다.
   생성 버튼과는 첫 화면 경계만큼 떨어져 있어 잘못 누를 일이 없습니다(애드센스 정책). */
.ad { display:block; min-height:280px; margin:24px 0; }
.ad:empty { display:none; }
.ad.ad-top { display:none; } /* 휴대폰 첫 화면 맨 위 배너 칸: 휴대폰에서만 보입니다 */

/* 스크롤하면 보이는 사용법·질문 */
.guide { margin-top:24px; padding:8px 24px 20px; }
.guide h2:first-child { margin-top:16px; }

/* 소개·개인정보처리방침 같은 글 페이지 */
.doc { padding:4px 24px 24px; }

/* 휴대폰: 맨 위 광고 칸(320×100)까지 넣고도 생성 버튼까지 한 화면에 들어오게 압축합니다 */
@media (max-width:559px) {
  header { height:44px; }
  .home header { display:none; } /* 첫 화면은 바로 아래 화면 로고+제목이 같은 역할이라 숨겨서 높이를 아낍니다 */
  .home main { padding-top:8px; }
  /* 화면 아래에 붙는 띠 광고(애드센스 자동 광고의 앵커 광고)가 생성 버튼을 가리지 않게 아래를 비워 둡니다 */
  .stage { justify-content:flex-start; padding-bottom:72px; }
  /* 광고 칸은 비어 있어도 높이를 잡아 둡니다 (광고가 떠도 생성기가 밀리지 않게) */
  .ad.ad-top, .ad.ad-top:empty { display:block; width:100%; max-width:320px; height:100px; min-height:100px; margin:0 auto 10px; overflow:hidden; }
  .guide { padding:4px 16px 16px; }
  .logo { font-size:15px; }
  .logo img { width:26px; height:26px; }
  main { padding-top:4px; }
  /* 로고를 카드 왼쪽 끝과 같은 세로줄에, 제목은 로고 높이 가운데에 */
  .hero { flex-direction:row; justify-content:flex-start; align-items:center; gap:10px; margin:0 0 8px; padding-left:2px; text-align:left; }
  .hero-logo { width:38px; height:38px; margin:0; }
  .hero h1 { line-height:1.2; }
  .eyebrow { display:none; }
  h1 { font-size:24px; }
  .card { padding:10px 12px; border-radius:16px; }
  .chips.scroll { margin:0 -12px; padding:2px 12px; scroll-padding:0 12px; }
  .type-rows { gap:4px; }
  /* 글자 수 칩도 한 줄로 (웃긴 타입은 8개까지 늘어나 두 줄이 되면 생성 버튼이 밀립니다). 스크롤 막대는 숨김 */
  #lens { flex-wrap:nowrap; overflow-x:auto; margin:0 -12px; padding:2px 12px; scrollbar-width:none; }
  #lens::-webkit-scrollbar { display:none; }
  .form { gap:6px; }
  /* 작은 화면에서 잘 읽히게: 배경은 더 어둡게, 카드는 더 진하게, 글씨는 더 크고 밝게 */
  :root { --muted:#c4e2cf; --card:rgba(8,20,15,.88); }
  body::before { background:linear-gradient(180deg, rgba(8,18,14,.62), rgba(8,18,14,.88)), url("assets/bg-mobile.jpg") center / cover no-repeat, #0d1714; }
  .lbl { margin-bottom:5px; font-size:14px; }
  .chip { font-size:15px; padding:9px 14px; }
  .chip small { font-size:12px; }
  .chips.pos .chip { font-size:14px; padding:11px 12px; }
  .opt input:disabled + .chip { opacity:.5; }
  .result { margin-top:6px; padding-top:4px; }
  .note { margin-top:0; font-size:14px; }
  .generate { margin-top:8px; min-height:50px; }
  .ad { min-height:250px; }
}

/* 화면이 짧은 휴대폰(아이폰 SE 등)은 위 광고와 아래 띠 광고를 함께 넣을 높이가 없어서,
   위 광고 칸을 숨기고 아래 띠 광고만 씁니다 (생성 버튼이 가려지지 않게) */
@media (max-width:559px) and (max-height:600px) {
  .ad.ad-top, .ad.ad-top:empty { display:none; }
}

/* 아주 좁은 휴대폰(폭 360px 미만): 명사 줄 칩 5개가 들어가도록 줄 이름 칸과 글씨를 줄입니다 */
@media (max-width:359px) {
  .tlabel { width:30px; font-size:11px; }
  .trow { gap:6px; }
  .tgrid { gap:4px; }
  .tgrid .chip { font-size:13px; }
}

/* 컴퓨터: 왼쪽 설정, 오른쪽 결과의 2단 카드로 노트북 화면(높이 약 650px)에서도 생성 버튼까지 한 화면에 */
@media (min-width:900px) {
  body { font-size:18px; }
  header, main, footer { max-width:880px; }
  header { height:56px; }
  .home .stage { min-height:calc(100vh - 56px); min-height:calc(100svh - 56px); }
  .hero { flex-direction:row; justify-content:center; gap:16px; margin:0 0 14px; text-align:left; }
  .hero-logo { width:76px; height:76px; margin:0; }
  .eyebrow { font-size:13px; }
  h1 { font-size:38px; }
  .tool { display:grid; grid-template-columns:1.5fr 1fr; gap:0 28px; align-items:center; padding:24px; }
  .tool .result { align-self:stretch; display:flex; flex-direction:column; justify-content:center;
    margin:0; padding:0 0 0 28px; border-top:0; border-left:1px solid var(--line); }
  .form { gap:14px; }
  .lbl { font-size:15px; }
  input, .chips.pos .chip { min-height:50px; font-size:16px; }
  .chip { font-size:14px; padding:9px 12px; }
  /* 컴퓨터에선 타입 칩을 줄바꿈해서 한눈에 */
  .chips.scroll { flex-wrap:wrap; overflow:visible; margin:0; padding:0; }
  .nick-result { font-size:min(72px, calc((100cqw - 8px) / var(--n, 3))); }
  .nick-result.warning { min-height:calc(min(72px, (100cqw - 8px) / 3) * 1.2); font-size:17px; }
  .generate { min-height:60px; max-width:420px; font-size:20px; margin-top:24px; }
  .note, footer { font-size:15px; }
  .ad { min-height:250px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation:none !important; transition:none !important; }
  .fireflies { display:none; }
}
