/* My Korean Name — 한지 위 붓글씨 이름 카드
   Layout: 따뜻한 한지색 바탕, 가운데 한 단. 위에 언어 전환, 이름 카드는 이중 괘선 종이에 붓글씨 한글과 붉은 낙관.
   아래로 한국 이름 설명 본문과 인기 이름 목록(검색·애드센스 콘텐츠). 한 가지 모습으로 고정 */
:root {
  color-scheme: light;
  --paper: #F4EEE2;     /* 한지 */
  --card: #FFFCF6;      /* 카드 종이 */
  --ink: #1D1915;       /* 먹 */
  --ink-soft: #6E6253;  /* 옅은 먹 */
  --line: #E2D7C3;      /* 괘선 */
  --seal: #B32B22;      /* 인주 */
  --accent: #2F5D50;    /* 버튼 청록 먹 */
  --f-body: "Be Vietnam Pro", "Zen Kaku Gothic New", "Apple SD Gothic Neo", sans-serif;
  --f-brush: "Nanum Brush Script", "Noto Serif KR", serif;
  --f-han: "Noto Serif KR", "Songti SC", serif;
}
:lang(ja) { --f-body: "Zen Kaku Gothic New", "Hiragino Sans", sans-serif; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.65;
  padding-inline: 16px; padding-block: 16px 40px; overflow-wrap: anywhere; -webkit-text-size-adjust: 100%; }
:lang(ja) body, body:lang(ja) { line-break: strict; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.page { max-width: 480px; margin: 0 auto; display: grid; gap: 22px; }
.langs { display: flex; justify-content: center; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 4px; justify-self: center; }
.langs a, .langs span { padding: 4px 14px; border-radius: 99px; font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink-soft); }
.langs span { background: var(--ink); color: var(--card); }
.langs a:hover { color: var(--ink); }

.screen { display: grid; gap: 16px; }
.kicker { margin: 0; text-align: center; font-size: 13px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--seal); }
.title { margin: 0; text-align: center; font-weight: 800; font-size: clamp(32px, 9vw, 42px); line-height: 1.15; letter-spacing: -.02em; }
.brushline { margin: -8px 0 0; text-align: center; font-family: var(--f-brush); font-size: 44px; line-height: 1; color: var(--ink-soft); }
.hook { margin: 0; text-align: center; color: var(--ink-soft); text-wrap: balance; }

.form { display: grid; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; }
.field > span, .field legend { font-size: 14px; font-weight: 700; padding: 0; }
input[type="text"], select { width: 100%; min-height: 48px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; padding: 10px 12px; font-size: 16px; }
input[type="text"]:focus, select:focus { border-color: var(--ink); outline: none; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: grid; place-items: center; min-height: 44px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-size: 14px; font-weight: 600; text-align: center; padding: 4px; cursor: pointer; }
.seg input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--card); }
.seg input:focus-visible + span { outline: 2px solid var(--seal); outline-offset: 2px; }
.err { margin: 0; color: var(--seal); font-size: 14px; font-weight: 600; }
.btn { appearance: none; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; min-height: 54px; padding: 12px 18px;
  border-radius: 14px; background: var(--ink); color: var(--card); font-weight: 800; font-size: 17px; box-shadow: 0 4px 0 #000; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #000; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); box-shadow: none; }
.note { margin: 0; font-size: 13px; color: var(--ink-soft); text-align: center; }

.loading { justify-items: center; padding: 40px 0; text-align: center; }
.brush { width: 220px; height: 14px; border-radius: 99px; background: var(--line); overflow: hidden; }
.brush i { display: block; height: 100%; width: 40%; border-radius: 99px; background: var(--ink); animation: stroke 1s ease-in-out infinite; }
@keyframes stroke { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.loading p { margin: 0; font-weight: 700; }

/* 이름 카드 */
.namecard { display: grid; gap: 14px; }
.nc-paper { position: relative; background: var(--card); padding: 34px 20px 26px; text-align: center; border: 2px solid var(--ink); outline: 1px solid var(--ink); outline-offset: -9px; }
.nc-seal { position: absolute; right: 16px; bottom: 16px; width: 54px; height: 54px; display: grid; place-items: center; border: 3px solid var(--seal); color: var(--seal);
  font-family: var(--f-han); font-weight: 900; font-size: 30px; transform: rotate(-6deg); box-shadow: inset 0 0 0 2px var(--card), inset 0 0 0 3.5px var(--seal); }
.nc-ko { margin: 0; font-family: var(--f-brush); font-size: clamp(88px, 28vw, 128px); line-height: 1; letter-spacing: .02em; }
.nc-read { margin: 8px 0 0; font-weight: 800; font-size: 22px; }
.nc-read span { font-weight: 600; font-size: 15px; color: var(--ink-soft); }
.nc-hanja { margin: 8px 0 0; font-family: var(--f-han); font-weight: 900; font-size: 30px; letter-spacing: .4em; padding-left: .4em; }
.nc-line { margin: 0; text-align: center; font-size: 17px; font-weight: 600; text-wrap: balance; }
.nc-rows { margin: 0; display: grid; gap: 6px; }
.nc-rows div { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.nc-rows dt { display: grid; justify-items: center; }
.nc-rows .ch { font-family: var(--f-han); font-weight: 900; font-size: 30px; line-height: 1.1; }
.nc-rows small { font-size: 11px; color: var(--ink-soft); }
.nc-rows dd { margin: 0; font-size: 15px; }
.listen { justify-self: center; appearance: none; cursor: pointer; border: 1.5px solid var(--line); background: var(--card); border-radius: 99px; padding: 6px 16px; font-weight: 700; font-size: 14px; }
.listen:hover { border-color: var(--ink); }
.actions { display: grid; gap: 10px; }
.sharebox { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 14px; resize: none; background: #fff; }
.ribbon { justify-self: center; margin: 0; padding: 4px 14px; border-radius: 99px; background: var(--seal); color: #fff; font-size: 14px; font-weight: 700; }

/* 본문 */
.about, .index, .pairs { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px 18px 8px; }
.about h2, .index h2, .pairs h2 { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.about p { margin: 0 0 16px; color: #3A332A; }
.index h3 { margin: 10px 0 6px; font-size: 13px; letter-spacing: .08em; color: var(--ink-soft); }
.index ul, .pairs ul { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.index a { display: inline-flex; gap: 6px; align-items: baseline; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; font-size: 14px; background: #fff; }
.index a b { font-size: 16px; }
.index a[aria-current] { border-color: var(--ink); background: var(--ink); color: var(--card); }
.pairs li { border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; font-size: 14px; background: #fff; }
.pairs li b { font-size: 17px; margin-right: 4px; }

.ad { border: 1px dashed #CDBFA7; border-radius: 12px; min-height: 90px; display: grid; place-items: center; font-size: 12px; letter-spacing: .1em; color: #A8997F; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 99px; padding: 10px 18px; font-size: 14px; z-index: 5; max-width: calc(100% - 32px); text-align: center; }
.foot { max-width: 480px; margin: 22px auto 0; text-align: center; font-size: 12.5px; color: var(--ink-soft); }
.foot p { margin: 4px 0; }
.foot a { color: inherit; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.otherlangs { margin: 4px 0; }
.otherlangs a { color: var(--ink); font-weight: 600; }
