/* Hanja O — 한자어로 배우는 한국어 어휘 */

:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e7e3dc;
  --accent: #b5462f;      /* 인주(印朱) 붉은색 */
  --accent-soft: #f4e4df;
  --hanja-bg: #2b2622;
  --hanja-ink: #f7f2e9;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px 80px; }

/* ── Header ── */
.site-header { padding: 28px 0 8px; text-align: center; }
.site-header a.logo { display: inline-flex; align-items: baseline; gap: 10px; }
.logo .mark {
  font-size: 30px; font-weight: 700; color: var(--accent);
  border: 2.5px solid var(--accent); border-radius: 8px;
  width: 46px; height: 46px; display: inline-flex; align-items: center;
  justify-content: center; line-height: 1;
}
.logo .name { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.tagline { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

/* ── Search ── */
.search { margin: 24px 0 8px; }
.search form { display: flex; gap: 8px; }
.search input[type=text] {
  flex: 1; font-size: 18px; padding: 14px 18px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); outline: none;
}
.search input[type=text]:focus { border-color: var(--accent); }
.search button {
  font-size: 16px; font-weight: 600; padding: 0 22px;
  border: none; border-radius: 12px; background: var(--accent);
  color: #fff; cursor: pointer;
}
.search button:hover { filter: brightness(1.05); }
.hint { color: var(--muted); font-size: 13px; margin: 10px 2px 0; }

/* ── Section labels ── */
.label {
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin: 32px 0 12px;
}

/* ── Word chips (grid) ── */
.word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.word-chip {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; transition: .12s;
}
.word-chip:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.word-chip .hangul { font-size: 20px; font-weight: 600; }
.word-chip .hanja { color: var(--accent); font-size: 15px; margin-left: 6px; }
.word-chip .en { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ── Decomposition view ── */
.word-head { text-align: center; margin: 28px 0 8px; }
.word-head .hangul { font-size: 44px; font-weight: 700; letter-spacing: -.02em; }
.word-head .hanja-form { font-size: 26px; color: var(--accent); margin-top: 2px; }
.word-head .gloss { color: var(--muted); font-size: 17px; margin-top: 8px; }
.word-head .gloss .ko { display:block; font-size: 15px; margin-top: 2px; }

.blocks { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin: 28px 0; }
.plus { align-self: center; font-size: 26px; color: var(--muted); }

.block {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 16px; min-width: 128px;
  text-align: center; box-shadow: var(--shadow); transition: .12s;
}
.block:hover { border-color: var(--accent); transform: translateY(-2px); }
.block .char {
  display: inline-flex; align-items: center; justify-content: center;
  width: 68px; height: 68px; margin: 0 auto 8px;
  background: var(--hanja-bg); color: var(--hanja-ink);
  border-radius: 12px; font-size: 40px; font-weight: 600;
}
.block .syllable { font-size: 22px; font-weight: 700; }
.block .reading { color: var(--muted); font-size: 14px; }
.block .meaning-ko { font-size: 15px; margin-top: 4px; }
.block .meaning-en { color: var(--muted); font-size: 13px; }
.block .more { display: block; color: var(--accent); font-size: 12px; margin-top: 8px; font-weight: 600; }

.native-note {
  text-align: center; background: var(--accent-soft); color: #7a3421;
  border-radius: var(--radius); padding: 16px; margin: 24px 0; font-size: 15px;
}

/* ── Related words (on hanja page & inline) ── */
.related { margin-top: 8px; }
.related .head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.related .head .big-char {
  width: 52px; height: 52px; background: var(--hanja-bg); color: var(--hanja-ink);
  border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 600;
}
.related .head .meta .rd { font-weight: 700; }
.related .head .meta .mn { color: var(--muted); font-size: 14px; }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; font-size: 15px; transition: .12s;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill .en { color: var(--muted); font-size: 13px; margin-left: 6px; }

.back { display: inline-block; color: var(--muted); font-size: 14px; margin: 20px 0 0; }
.back:hover { color: var(--accent); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f; --surface: #221e18; --ink: #f0ebe2; --muted: #a39d92;
    --line: #38322a; --accent: #e0765c; --accent-soft: #3a2620; --hanja-bg: #0e0c09;
  }
  .native-note { color: #f0c2b3; }
}
