/* 중국어 단어장 v3 — 깔끔하게 (시안 B)
   흰 바탕 · 검은 글씨 · 회색 보조글. 색은 병음 파랑 하나. 장식 없음. */
:root {
  --bg: #ffffff;
  --ink: #1d1d1f;
  --sub: #86868b;
  --line: #ececee;
  --soft: #f5f5f7;
  --py: #3d6fd9;      /* 병음 */
  --btn: #1d1d1f;
  --btn-ink: #ffffff;
  --err: #d70015;
  --hanzi: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --ink: #f5f5f7; --sub: #98989d; --line: #2c2c2e; --soft: #1c1c1e;
    --py: #6e9bff; --btn: #f5f5f7; --btn-ink: #000000; --err: #ff6961;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--py); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

main {
  max-width: 560px; margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 20px calc(40px + env(safe-area-inset-bottom));
}
h1 { margin: 0 0 16px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }

/* 탭: 회색 판 위의 흰 버튼 */
.seg { display: flex; padding: 3px; margin-bottom: 22px; border-radius: 10px; background: var(--soft); }
.seg button { flex: 1; height: 34px; border-radius: 8px; color: var(--sub); font-weight: 500; }
.seg button[aria-selected="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
@media (prefers-color-scheme: dark) { .seg button[aria-selected="true"] { background: #3a3a3c; } }
.count { margin-left: 2px; }

/* 번역 */
textarea {
  display: block; width: 100%; min-height: 96px; resize: none;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--soft); color: var(--ink); font: inherit; font-size: 16px;
}
textarea:focus { outline: none; border-color: var(--sub); background: var(--bg); }
.go {
  display: block; width: 100%; height: 48px; margin-top: 8px; border-radius: 12px;
  background: var(--btn); color: var(--btn-ink); font-weight: 600;
}
.go:disabled { opacity: .5; cursor: progress; }

.result { margin-top: 28px; padding: 28px 8px 8px; border-top: 1px solid var(--line); text-align: center; }
.result .zh { font-size: 40px; }
.result .ko { margin: 4px 0 16px; color: var(--sub); }
.result .play { width: 48px; height: 48px; margin: 0 auto; background: var(--soft); }

.zh { font-family: var(--hanzi); font-weight: 500; line-height: 1.9; word-break: break-all; }
.zh rt { font-family: system-ui, sans-serif; font-size: .42em; font-weight: 500; color: var(--py); }

.status { min-height: 1.5em; margin: 12px 0 0; text-align: center; color: var(--sub); font-size: 13px; }
.status.error { color: var(--err); }
.status:empty { min-height: 0; margin: 0; }

/* 버튼 (발음 · 삭제) */
.play, .del { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.play svg, .del svg { width: 20px; height: 20px; }
.play { color: var(--ink); }
.play.on { background: var(--btn); color: var(--btn-ink); }   /* 재생 중 */
.del { color: var(--sub); }
@media (hover: hover) {
  .play:hover, .del:hover { background: var(--soft); }
  .play.on:hover { background: var(--btn); }
}

/* 단어장 */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 4px; padding: 14px 0; border-top: 1px solid var(--line); }
.list li:last-child { border-bottom: 1px solid var(--line); }
.list .t { flex: 1; min-width: 0; }
.list .zh { font-size: 24px; }
.list .ko { margin-top: -2px; color: var(--sub); font-size: 14px; }

.voice-warn { margin: 24px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--soft); color: var(--sub); font-size: 13px; }

/* PC: 같은 한 줄 구성, 조금 여유 있게 */
@media (min-width: 900px) {
  main { max-width: 640px; padding-top: 64px; }
  h1 { font-size: 26px; }
  .result .zh { font-size: 52px; }
  .list .zh { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
