:root {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Noto Sans TC', sans-serif;
  color: #222; background: #fff; color-scheme: light; font-synthesis: none;
  --accent: #005a91; --line: #e5e5e5; --muted: #737373;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; display: flex; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
a { color: var(--accent); }
[hidden] { display: none !important; }
::selection { background: #005a9122; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sidebar { width: 218px; padding: 32px 16px 22px; border-right: 1px solid var(--line); position: fixed; height: 100dvh; display: flex; flex-direction: column; background: #fcfcfc; }
.brand { display: flex; gap: 11px; align-items: center; color: #222; text-decoration: none; font: 26px Georgia, 'Times New Roman', serif; letter-spacing: -.8px; padding: 0 10px; }
.brand-icon { width: 36px; height: 36px; flex: 0 0 36px; display: block; border-radius: 9px; }
.tagline { color: var(--muted); font-size: 10px; letter-spacing: .04em; padding: 0 10px; margin: 14px 0 43px; line-height: 1.8; }
nav { display: grid; gap: 5px; }
.filter { display: flex; align-items: center; justify-content: space-between; border: 0; border-left: 2px solid transparent; background: none; color: #666; padding: 12px 13px; text-align: left; font-size: 12px; }
.filter.active { background: #f0f4f6; border-left-color: var(--accent); color: var(--accent); font-weight: 600; }
.filter span:last-child { font-size: 10px; font-variant-numeric: tabular-nums; font-weight: 400; opacity: .65; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--line); padding: 21px 10px 0; }
.storage-label { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.dot { width: 5px; height: 5px; background: #a8a8a8; border-radius: 50%; }
body.cloud .dot { background: #326b4f; }
.sidebar-bottom p { color: var(--muted); font-size: 10px; line-height: 1.9; margin: 10px 0 16px; }
.sidebar-bottom .button { width: 100%; }
main { margin-left: 218px; width: calc(100% - 218px); padding: 48px clamp(24px, 4vw, 70px) 30px; max-width: 1700px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 29px; border-bottom: 1px solid var(--line); margin-bottom: 25px; }
.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.eyebrow { color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .2em; margin: 0 0 14px; }
h1 { font: 400 clamp(28px, 3vw, 39px) Georgia, 'Times New Roman', serif; letter-spacing: -.7px; margin: 0; }
.intro { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 11px 0 0; }
.button { padding: 9px 13px; background: #fff; border: 1px solid #d9d9d9; border-radius: 2px; color: #555; white-space: nowrap; font-size: 11px; font-weight: 500; min-height: 34px; }
.button:hover { background: #f5f5f5; border-color: #bfbfbf; }
.button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: #003f67; }
.button.quiet { background: none; }
.toolbar { display: flex; gap: 7px; margin: 0 0 26px; }
.toolbar input { flex: 1; min-width: 0; padding: 11px 13px; font-size: 12px; background: #fafafa; }
.collection-heading { display: flex; justify-content: space-between; align-items: baseline; }
.collection-heading h2 { font-size: 13px; font-weight: 600; margin: 0; }
.collection-heading > span { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
#status { min-height: 17px; color: var(--muted); font-size: 11px; margin: 9px 0 15px; }
#status.error, .error { color: #a44237; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(275px, 1fr)); column-gap: 28px; row-gap: 26px; }
.card { display: flex; flex-direction: column; min-width: 0; padding: 24px 0 14px; background: #fff; border-top: 1px solid #bfbfbf; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
.word { font: 400 27px Georgia, 'Times New Roman', serif; margin: 0; overflow-wrap: anywhere; letter-spacing: -.4px; line-height: 1.3; }
.badge { font-size: 9px; white-space: nowrap; color: #777; border: 1px solid #e5e5e5; padding: 3px 6px; border-radius: 2px; }
.badge.learning { color: #005a91; border-color: #dce7ee; background: #f6f9fb; }
.badge.known { color: #326b4f; border-color: #dce7df; }
.phonetic { font-size: 11px; color: var(--muted); margin: 10px 0 16px; min-height: 14px; }
.meaning { margin: 0 0 19px; font-size: 13px; line-height: 1.95; white-space: pre-wrap; overflow-wrap: anywhere; }
.quote { margin: 0 0 20px; border-left: 1px solid #ccc; padding-left: 13px; font: italic 14px/1.85 Georgia, 'Times New Roman', serif; color: #777; white-space: pre-wrap; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; }
.tag { font-size: 9px; color: #737373; background: #f6f6f6; padding: 3px 6px; border-radius: 2px; }
.card-bottom { display: flex; align-items: center; gap: 12px; padding-top: 14px; margin-top: 17px; border-top: 1px solid #f0f0f0; }
.card-bottom a { max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; color: var(--muted); }
.card-actions { display: flex; gap: 12px; margin-left: auto; }
.card-actions .button { border: 0; padding: 2px 0; font-size: 10px; min-height: 26px; background: none; color: #737373; }
.card-actions .button:hover { color: var(--accent); }
.empty { text-align: center; padding: 72px 15px 90px; }
.empty-symbol { color: #c1c1c1; font: italic 46px Georgia, serif; }
.empty h2 { font-size: 16px; font-weight: 500; margin-top: 22px; }
.empty p { color: var(--muted); font-size: 12px; line-height: 1.9; }
footer { display: flex; gap: 12px; border-top: 1px solid var(--line); margin-top: 45px; padding-top: 21px; color: #888; }
footer strong { font-size: 10px; font-weight: 500; }
footer p { font-size: 10px; line-height: 1.9; margin: 6px 0 0; }
.footer-symbol { font-size: 21px; color: #aaa; }
input, textarea, select { padding: 10px 11px; background: #fff; border: 1px solid #d9d9d9; border-radius: 2px; max-width: 100%; }
textarea { resize: vertical; }
label { display: grid; gap: 7px; font-size: 11px; margin: 17px 0; }
dialog { width: min(590px, calc(100% - 28px)); max-height: 92dvh; overflow-y: auto; border: 1px solid #d9d9d9; border-radius: 4px; padding: 28px; color: #222; background: #fff; box-shadow: 0 15px 70px #0000001a; }
dialog::backdrop { background: #22222236; backdrop-filter: blur(2px); }
dialog h2 { font-size: 18px; font-weight: 500; margin: 0; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 23px; }
.close { background: none; border: 0; font-size: 22px; padding: 0 5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid > * { min-width: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--line); margin-top: 25px; padding-top: 20px; }
dialog p, dialog a { font-size: 11px; line-height: 1.9; }
.muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.error:empty { display: none; }
@media (max-width: 950px) {
  .sidebar { width: 184px; padding: 26px 12px 20px; }
  main { width: calc(100% - 184px); margin-left: 184px; padding: 35px 26px; }
  .brand { font-size: 22px; gap: 8px; padding: 0 6px; }
  header { align-items: flex-start; }
  .toolbar { flex-wrap: wrap; }
  .toolbar input { flex-basis: 100%; }
}
@media (max-width: 680px) {
  body { display: block; }
  .sidebar { position: static; width: 100%; height: auto; border-right: 0; padding: max(20px, env(safe-area-inset-top)) 18px 12px; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; font-size: 27px; }
  .tagline { display: none; }
  nav { display: flex; gap: 5px; overflow-x: auto; margin-top: 21px; }
  .filter { white-space: nowrap; padding: 9px 11px; gap: 10px; border-left: 0; border-bottom: 2px solid transparent; }
  .filter.active { border-bottom-color: var(--accent); }
  .sidebar-bottom { margin: 14px 0 0; padding: 12px 0 0; display: flex; justify-content: space-between; align-items: center; }
  .sidebar-bottom p { display: none; }
  .sidebar-bottom .button { width: auto; }
  main { margin: 0; width: 100%; padding: 25px 20px max(30px, env(safe-area-inset-bottom)); }
  header { gap: 14px; margin-bottom: 20px; }
  h1 { font-size: 31px; }
  .eyebrow { font-size: 8px; }
  .intro { max-width: 230px; font-size: 11px; }
  .toolbar .button { flex: 1; }
  .cards { grid-template-columns: 1fr; }
  input, textarea, select { font-size: 16px; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .form-grid label { margin: 9px 0; }
  dialog { padding: 23px; max-height: calc(100dvh - 24px); }
}
