:root {
  color-scheme: light;
  --ink: #16181d;
  --ink-2: #4b5162;
  --muted: #8a90a0;
  --line: #e6e8ee;
  --surface: #ffffff;
  --canvas: #f6f7f9;
  --accent: #2f6fed;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 460px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.back {
  border: none;
  background: none;
  font-size: 14px;
  font-family: inherit;
  color: var(--accent);
  padding: 6px 0;
}

.hint { font-size: 13px; color: var(--muted); }

h1 { font-size: 26px; letter-spacing: -.5px; margin: 0 0 14px; }
h2 { font-size: 17px; margin: 0 0 8px; font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.page-intro { margin: -4px 0 22px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }

.hero {
  background: transparent;
  color: var(--ink);
  padding: 8px 0 16px;
  margin-bottom: 0;
}

.hero .label { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.hero .num { font-size: 44px; font-weight: 700; line-height: 1.1; }
.hero .num small { font-size: 14px; font-weight: 400; margin-left: 4px; }
.hero-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.new-count { font-size: 13px; color: var(--accent); }
.hero .sub { font-size: 13px; color: var(--ink-2); line-height: 1.6; margin-top: 10px; }

.card {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
}

button.primary,
button.ghost {
  width: 100%;
  padding: 13px;
  font-size: 16px;
  font-family: inherit;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  margin-top: 10px;
}

button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { border-color: #dc2626; color: #dc2626; }

textarea, input {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}

textarea { min-height: 160px; resize: vertical; }

.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.word-box {
  text-align: center;
  padding: 46px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.word-box .word { font-size: 32px; font-weight: 600; letter-spacing: 0.3px; }
.word-box .meaning { margin-top: 18px; font-size: 17px; color: var(--ink-2); }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.list-row:last-child { border-bottom: none; }
.list-row .zh { color: var(--muted); font-size: 13px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #16181d;
  color: #fff;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.toast.show { opacity: 1; }

.progress {
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress > span { display: block; height: 100%; background: var(--accent); }

.mini {
  font-family: inherit;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  white-space: nowrap;
}

.mini.danger { border-color: #dc2626; color: #dc2626; }

button:disabled { opacity: 0.5; }
select {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  margin-top: 6px;
}
.group-title {
  font-size: 13px;
  color: var(--muted);
  margin: 18px 4px 8px;
}
.candidate-divider { padding: 10px 12px; border-left: 3px solid var(--accent); background: #edf3ff; border-radius: 8px; color: #315185; line-height: 1.6; }
.candidate-simple { margin-top: 24px; border-left-color: #60766b; background: #edf3ef; color: #405e4e; }

.inline-input {
  width: 100%;
  font-size: 16px;
  padding: 6px 8px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
}

.inline-input:focus {
  border-color: var(--accent);
  background: #fff;
  outline: none;
}

/* 阎王点卯 */
.filter-bar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filter-btn {
  flex: 1 1 auto; min-width: 0; font-family: inherit; font-size: 13px;
  padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.bar-right { display: flex; gap: 10px; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.filter-tag {
  font-size: 12px; padding: 4px 8px; border-radius: 999px;
  background: #eef2ff; color: #3730a3;
}
.filter-tag b { cursor: pointer; margin-left: 4px; }
.wb-row { align-items: flex-start; }
.wb-main { flex: 1; min-width: 0; }
.wb-word { font-size: 16px; font-weight: 600; }
.wb-phon { font-size: 12px; color: var(--muted); margin-left: 6px; font-weight: 400; }
.wb-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #f1f3f7; color: var(--ink-2); }
.chip-done { background: #e8f5ec; color: #166534; }
.wb-actions { display: flex; flex-direction: column; gap: 6px; }
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(16, 18, 24, 0.4);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.sheet {
  width: 100%; max-width: 460px; background: var(--surface);
  border-radius: 18px 18px 0 0; padding: 18px 18px max(26px, env(safe-area-inset-bottom));
  max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain;
}
.sheet-title { font-weight: 600; margin-bottom: 12px; }
.sheet-option {
  display: block; width: 100%; text-align: left; font-family: inherit; font-size: 15px;
  padding: 12px; border: none; background: none; color: var(--ink); border-radius: 10px;
}
.sheet-option.is-on { background: #eef2ff; color: #1d4ed8; }
.chip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 14px; }
.chip-btn {
  font-family: inherit; font-size: 13px; padding: 9px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}
.chip-btn.is-on { border-color: var(--accent); color: var(--accent); background: #eef2ff; }

/* 延续旧版的留白、白卡和蓝色主操作；照片是可累计的选择队列。 */
button { cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #9bbcff; outline-offset: 3px; }
.home-primary { min-height: 66px; font-weight: 600; }
.home-primary span { display: block; font-size: 12px; font-weight: 400; margin-top: 5px; opacity: .9; }
.section-label { margin: 26px 0 12px; color: var(--muted); font-size: 13px; }
.shortcut-list { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 2px 4px #16181d04; }
.shortcut { width: 100%; padding: 19px 20px; border: 0; background: transparent; display: flex; text-align: left; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink); font-family: inherit; }
.shortcut + .shortcut { border-top: 1px solid var(--line); }
.shortcut strong { display: block; font-size: 17px; font-weight: 600; }
.shortcut small { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.shortcut > span:last-child { font-size: 24px; color: var(--muted); }
.fold { margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; font-size: 14px; }
.photo-heading { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.photo-heading p { margin: 0; line-height: 1.5; }
.photo-count { flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--accent); background: #edf3ff; padding: 6px 9px; border-radius: 8px; }
.photo-actions button { min-width: 0; font-size: 14px; padding: 13px 6px; }
.photo-actions { margin: 5px 0 14px; }
.photo-empty { border: 1px dashed #d4d9e3; border-radius: 12px; padding: 25px 14px; font-size: 13px; color: var(--muted); line-height: 1.7; text-align: center; }
.photo-grid { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.photo-tile { position: relative; overflow: hidden; border-radius: 10px; background: var(--canvas); border: 1px solid var(--line); padding-bottom: 44px; }
.photo-tile img { display: block; width: 100%; height: 100px; object-fit: cover; }
.photo-badge { display: block; font-size: 10px; padding: 5px 4px; color: var(--ink-2); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.photo-remove { position: absolute; bottom: 0; width: 100%; min-height: 44px; border: none; border-top: 1px solid var(--line); color: #b42318; background: #fff; font-family: inherit; font-size: 12px; }
.photo-help { font-size: 12px; line-height: 1.7; margin: 12px 0 0; }
.photo-progress { font-size: 13px; color: var(--accent); line-height: 1.7; margin-top: 8px; }
.photo-progress:empty { display: none; }
.model-note { font-size: 12px; line-height: 1.6; margin-top: 12px; overflow-wrap: anywhere; }
.photo-card + .card textarea { margin-top: 12px; min-height: 125px; }
.list-row > label, .list-row > label > span { min-width: 0; }
.toast { z-index: 100; width: max-content; max-width: calc(100vw - 32px); border-radius: 12px; line-height: 1.6; bottom: max(28px, env(safe-area-inset-bottom)); }
.update-notice { position: fixed; z-index: 90; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 2px 12px #16181d12; padding: 10px 14px; border-radius: 0 0 12px 12px; font-size: 13px; line-height: 1.5; }
.update-notice span { flex: 1; }
@media (max-width: 360px) { .card { padding: 16px; } .photo-tile img { height: 80px; } }

body.has-update .app { padding-top: 74px; }
.storage-copy { font-size: 13px; line-height: 1.8; margin: 10px 0; color: var(--ink-2); }
.storage-label { font-size: 12px; color: var(--muted); margin: 16px 0 8px; }
.storage-location { display: block; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); font-family: inherit; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; white-space: pre-wrap; }
.storage-card .row > button { font-size: 13px; padding-inline: 5px; min-width: 0; }
.storage-feedback { font-size: 13px; line-height: 1.8; color: #315185; overflow-wrap: anywhere; }
.storage-feedback:empty { display: none; }
#storage-usage { white-space: pre-line; line-height: 1.8; margin-top: 12px; }
.backup-file { width: 100%; text-align: left; font-family: inherit; font-size: 13px; line-height: 1.8; border: 1px solid var(--line); padding: 12px; margin-top: 12px; border-radius: 10px; background: #fff; color: var(--ink); overflow-wrap: anywhere; }
.backup-file span { display: block; color: var(--muted); font-size: 12px; }
.export-sheet .sheet-title { margin-bottom: 0; font-size: 17px; }
.export-sheet .bar { margin-bottom: 12px; }
.export-pager { align-items: center; margin: 14px 0 10px; gap: 8px; }
.export-pager > button { flex: 0 0 auto; min-height: 40px; }
.export-pager > span { font-size: 12px; color: var(--ink-2); text-align: center; line-height: 1.6; }
#export-preview { min-height: 145px; line-height: 1.6; }
.export-warning { margin: 12px 0; padding: 12px; background: #fff7ed; color: #92400e; border-radius: 10px; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.export-warning ul { padding-left: 18px; margin-bottom: 0; }
#export-to-backup { line-height: 1.6; text-align: left; }
.update-notice .close-update { font-size: 16px; line-height: 1; color: var(--muted); background: none; border: none; padding: 4px 6px; }
