.wchip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.15rem 0.5rem;
  margin: 0.15rem 0.2rem;
  font-size: 0.92rem;
}

.wchip b {
  font-size: 1.05rem;
}

.wchip-tl {
  color: var(--accent-deep);
}

textarea,
#vb-in,
#gr-in {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfd;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  min-height: 6.5rem;
  resize: vertical;
}

#vb-in,
#gr-in {
  min-height: 0;
  max-width: 32rem;
}

textarea:focus,
#vb-in:focus,
#gr-in:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
  background: #fff;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.seg-btn {
  border: 0;
  background: var(--card);
  padding: 0.45rem 1rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-soft);
}

.seg-btn.is-active {
  background: var(--accent-deep);
  color: var(--accent-ink);
}

.hints {
  margin-top: 0.8rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.6rem;
  font-size: 0.92rem;
}

.hints .hint-title {
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.hints ul {
  margin: 0.3rem 0 0;
  padding-inline-start: 1.2rem;
}

.hints code {
  background: var(--accent-soft);
  color: var(--accent-deep);
  padding: 0.05em 0.4em;
  border-radius: 6px;
}

.hints details.calque {
  margin-top: 0.5rem;
}

.hints summary {
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
}


/* —— 文法檢查佮教學（轉換頁 #cv-gram） —— */
.hints .chk-list li {
  margin: 0.25rem 0;
  line-height: 1.75;
}

.chk-han {
  /* 建議檢查，毋是判錯：虛線底標「看這搭」，無用紅色 */
  border-bottom: 2px dotted var(--ink-soft);
}

.chk-n {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.chk-note {
  margin-left: 0.4rem;
  font-size: 0.75rem;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border: none;
  border-radius: 6px;
  padding: 0.05rem 0.45rem;
  cursor: pointer;
}

.gram-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.gram-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.55rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.gram-chip:hover {
  border-color: var(--accent);
}

.gram-chip b {
  font-size: 0.98rem;
}

.gram-chip-t {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.gr-note.flash {
  animation: gr-flash 1.5s ease 2;
}

@keyframes gr-flash {
  0%,
  100% {
    background: transparent;
  }
  30% {
    background: #fff3c4;
  }
}
.dict-link {
  font-size: 0.72rem;
  color: var(--accent-deep);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.05rem 0.4rem;
  margin-inline-start: 0.3rem;
  vertical-align: middle;
  white-space: nowrap;
}

.dict-link:hover {
  background: var(--accent-soft);
}

.anno.word.rime:hover {
  background: #fdf0ee;
}

.row {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin-block: 0.7rem;
  flex-wrap: wrap;
}

.btn {
  padding: 0.55rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn.primary {
  background: var(--accent-deep);
  color: var(--accent-ink);
  border-color: transparent;
}

.btn.primary:hover {
  background: #095f57;
}

.btn-ghost {
  border: 0;
  background: transparent;
  color: var(--accent-deep);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
}

.btn-ghost:hover {
  background: var(--accent-soft);
}

.opt {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.hint {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.out-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: 1fr;
}

.out-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  background: linear-gradient(180deg, #fdfefe, #f7faf9);
}

.out-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.out-head h3 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.roman {
  display: block;
  font-size: 1.3rem;
  line-height: 1.95;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  min-height: 2.6em;
  margin-top: 0.25rem;
}

.anno {
  margin-top: 0.9rem;
  line-height: 2.15;
  overflow-wrap: anywhere;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--line);
}

.anno.word {
  border: 0;
  background: none;
  padding: 0 0.12em;
  cursor: pointer;
  border-bottom: 2px dotted var(--accent);
  font-size: 1.12rem;
  border-radius: 4px;
  transition: background 0.12s ease;
}

.anno.word:hover {
  background: var(--accent-soft);
}

.anno.word.rime {
  border-bottom: 2px dotted var(--miss);
}

.rimetag {
  display: inline-block;
  font-size: 0.66rem;
  color: var(--miss);
  border: 1px dashed var(--miss);
  border-radius: 5px;
  padding: 0 0.3rem;
  margin-inline-start: 0.35rem;
  vertical-align: middle;
  white-space: nowrap;
}

.anno.miss {
  color: var(--miss);
  font-weight: 700;
}

.ex-cell .ex {
  font-size: 0.92rem;
  line-height: 1.45;
  padding-block: 0.2rem;
}

.ex-cell .ex + .ex {
  border-top: 1px dashed var(--line);
  margin-top: 0.3rem;
  padding-top: 0.3rem;
}


.tbl-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

#vb-tbl,
#gr-tbl {
  width: 100%;
  border-collapse: collapse;
}

#vb-tbl th,
#vb-tbl td,
#gr-tbl th,
#gr-tbl td {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

#vb-tbl th,
#gr-tbl th {
  position: sticky;
  top: 0;
  background: #f7f9fa;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.gr-notes {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.7rem;
}

.gr-note {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem 0.55rem;
  background: linear-gradient(180deg, #fdfefe, #f7faf9);
}

.gr-note h4 {
  margin: 0.2rem 0 0.4rem;
  font-size: 1.06rem;
}

.gr-note p {
  font-size: 0.93rem;
  line-height: 1.78;
  margin: 0.3rem 0;
}

.gr-cat {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--accent-deep);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
}

.gr-ex {
  margin: 0.5rem 0;
  padding-inline-start: 0.8rem;
  border-inline-start: 3px solid var(--accent-soft);
}

.gr-ex .han {
  font-weight: 700;
  font-size: 1.02rem;
}

.gr-ex .tl {
  color: var(--accent-deep);
}

.gr-ex .hua {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.gr-refs {
  border-top: 1px dashed var(--line);
  margin-top: 0.6rem;
  padding-top: 0.45rem;
}

.gr-src-tag {
  display: inline-block;
  margin-inline-start: 0.45rem;
  font-size: 0.68rem;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 0.3rem;
  vertical-align: middle;
}

.gr-refs a {
  color: var(--accent-deep);
}

#vb-tbl tbody tr:nth-child(even),
#gr-tbl tbody tr:nth-child(even) {
  background: #fafbfc;
}

#vb-tbl td.w,
#gr-tbl td.w {
  font-weight: 700;
  white-space: nowrap;
}

#vb-tbl td.roman,
#gr-tbl td.roman {
  overflow-wrap: anywhere;
}

#gr-tbl td.gr-id {
  white-space: nowrap;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

#gr-group {
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfd;
  max-width: 22rem;
}

.gr-sub {
  margin: 1.4rem 0 0.3rem;
  font-size: 1.02rem;
  color: var(--accent-deep);
}

.gr-snips {
  margin: 0.3rem 0;
  padding-inline-start: 1.2rem;
  font-size: 0.95rem;
  line-height: 1.9;
}

.gr-snips a {
  color: var(--accent-deep);
  font-weight: 600;
}

@media (min-width: 48rem) {
  .out-grid {
    grid-template-columns: 1fr 1fr;
  }
}
