/* ================================================================
   HALAMAN: Kosakata — NihongoDo
   Desain kartu kosakata lengkap: romaji, pitch accent, tags, arti
   ================================================================ */

/* ── Grid & Kartu Dasar ──────────────────────────────────── */
.vocab-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-3) calc(var(--space-3) - 2px);
  background: var(--ink-2);
  transition:
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}
.vocab-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}
.vocab-card.is-mastered {
  border-color: var(--gold-dim);
  background: linear-gradient(160deg, var(--ink-2) 60%, var(--gold-ghost));
}

/* ── Header: Kata + Aksi ──────────────────────────────────── */
.vc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.vc-word-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.vc-word-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.vc-word {
  font-family: var(--font-display);
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  word-break: break-word;
}
.vc-speak {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  color: var(--text-faint);
  transition:
    color var(--dur-fast),
    background var(--dur-fast);
  line-height: 1;
}
.vc-speak:hover {
  color: var(--indigo-light);
  background: var(--indigo-ghost);
}

.vc-reading {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--indigo-light);
  letter-spacing: 0.02em;
}

/* Romaji — tersembunyi secara default, muncul saat .show-romaji aktif */
.vc-romaji {
  display: none;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-style: italic;
  color: var(--text-ghost);
  letter-spacing: 0.04em;
}
#vocab-grid.show-romaji .vc-romaji {
  display: block;
}

/* Badge penguasaan */
.vc-mastery-badge {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--mc, var(--jade-light));
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid currentColor;
  white-space: nowrap;
}
.vc-mastery-badge.mastered {
  color: var(--gold-light);
}

/* Aksi kanan atas */
.vc-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-ghost);
  font-size: 18px;
  padding: 2px 4px;
  transition:
    color var(--dur-fast),
    transform var(--dur-fast);
  line-height: 1;
  border-radius: 4px;
}
.fav-btn:hover {
  color: var(--gold-light);
  transform: scale(1.2);
}
.fav-btn.active {
  color: var(--gold);
}

/* ── Tags: JLPT + Kelas Kata ─────────────────────────────── */
.vc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.vc-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid transparent;
}
/* JLPT level colors */
.vc-tag-n5 {
  background: var(--jade-dim);
  color: var(--jade-light);
  border-color: var(--jade-dim);
}
.vc-tag-n4 {
  background: var(--indigo-dim);
  color: var(--indigo-light);
  border-color: var(--indigo-dim);
}
.vc-tag-n3 {
  background: var(--gold-dim);
  color: var(--gold-light);
  border-color: var(--gold-dim);
}
.vc-tag-n2 {
  background: var(--shu-dim);
  color: var(--shu-light);
  border-color: var(--shu-dim);
}
.vc-tag-n1 {
  background: var(--amethyst-dim);
  color: var(--amethyst-light);
  border-color: var(--amethyst-dim);
}
/* Kelas kata */
.vc-tag-pos {
  background: var(--ink-4);
  color: var(--text-faint);
  border-color: var(--border);
}
/* Badge kosakata tambahan (di luar 800 kata inti) */
.vc-tag-extended {
  background: var(--gold-dim);
  color: var(--gold-light);
  border-color: var(--gold-dim);
}

/* ── Arti ─────────────────────────────────────────────────── */
.vc-meanings {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
}
.vc-meaning-item {
  font-size: var(--fs-sm);
  color: var(--text-soft);
  line-height: 1.5;
}
.vc-meaning-item:not(:last-child)::after {
  content: " ·";
  color: var(--text-ghost);
  margin-left: 2px;
}

/* ── Pitch Accent ─────────────────────────────────────────── */

/* Inner wrap: inline-flex kolom, lebar = SVG width → sejajar sempurna */

/* Mora strip — lebar diset via inline style agar selaras dengan viewBox */

/* ── Contoh Kalimat ───────────────────────────────────────── */
.vc-examples {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 2px;
}
.vc-examples-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-size: 12px;
  color: var(--text-faint);
  padding: 2px 0;
  transition: color var(--dur-fast);
}
.vc-examples-toggle:hover {
  color: var(--text-soft);
}
.vc-examples[open] .vc-examples-toggle {
  color: var(--text-soft);
}
.vc-examples-toggle::-webkit-details-marker {
  display: none;
}

.vc-ex-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--ink-4);
  color: var(--indigo-light);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.example-list {
  list-style: none;
  padding: 8px 0 4px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ex-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: var(--ink-3);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--indigo-dim);
}
.ex-jp {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.ex-speak {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-ghost);
  padding: 1px 3px;
  border-radius: 3px;
  transition: color var(--dur-fast);
  flex-shrink: 0;
}
.ex-speak:hover {
  color: var(--indigo-light);
}
.ex-reading {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--indigo-light);
  opacity: 0.85;
}

/* Romaji contoh kalimat — tersembunyi default, muncul saat .show-romaji */
.ex-romaji {
  display: none;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-style: italic;
  color: var(--text-ghost);
  letter-spacing: 0.04em;
}
#vocab-grid.show-romaji .ex-romaji {
  display: block;
}

.ex-id {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.5;
}

/* ── Tab bentuk kalimat (Formal/Kasual/Pertanyaan/Negatif/Lampau) ── */
.ex-tabs-wrap {
  padding-top: 8px;
}
.ex-tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 10px;
}
.ex-tab-btn {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-faint);
  background: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  transition:
    color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.ex-tab-btn:hover {
  color: var(--text-soft);
  border-color: var(--border-light);
}
.ex-tab-btn.active {
  color: var(--indigo-light);
  background: var(--indigo-ghost);
  border-color: var(--indigo-dim);
}

.ex-form-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  background: var(--ink-3);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--indigo-dim);
}
.ex-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ex-row-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-ghost);
}
.ex-row-kanji .ex-jp {
  font-size: 15px;
}
.ex-row-furigana .ex-furigana {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
}
.ex-row-id .ex-id {
  color: var(--text);
}
.ex-row + .ex-row {
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

/* ── Sinonim & Antonim ────────────────────────────────────── */
.vc-relwords-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

/* Sinonim section (teal/jade) */
.vc-syn-section,
.vc-ant-section {
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.vc-syn-section {
  border: 1px solid var(--jade-dim);
  background: linear-gradient(
    135deg,
    var(--jade-ghost, rgba(32, 210, 160, 0.05)) 0%,
    transparent 100%
  );
}
.vc-ant-section {
  border: 1px solid var(--shu-dim);
  background: linear-gradient(135deg, rgba(210, 80, 60, 0.06) 0%, transparent 100%);
}

/* Section header */
.vc-relwords-hdr {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
}
.vc-syn-hdr {
  background: var(--jade-dim);
  border-bottom: 1px solid var(--jade-dim);
}
.vc-ant-hdr {
  background: var(--shu-dim);
  border-bottom: 1px solid var(--shu-dim);
}
.vc-relwords-icon {
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}
.vc-syn-hdr .vc-relwords-icon {
  color: var(--jade-light);
}
.vc-ant-hdr .vc-relwords-icon {
  color: var(--shu-light);
}
.vc-relwords-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.vc-syn-hdr .vc-relwords-label {
  color: var(--jade-light);
}
.vc-ant-hdr .vc-relwords-label {
  color: var(--shu-light);
}

/* Item content */
.vc-relword-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 7px;
}
.vc-relword-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.vc-relword-word {
  font-family: var(--font-display);
  font-size: clamp(18px, 4vw, 22px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  word-break: break-word;
}
.vc-relword-speak {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  color: var(--text-ghost);
  transition:
    color var(--dur-fast),
    background var(--dur-fast);
  line-height: 1;
  flex-shrink: 0;
}
.vc-relword-speak:hover {
  color: var(--indigo-light);
  background: var(--indigo-ghost);
}
.vc-relword-reading {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--indigo-light);
  letter-spacing: 0.02em;
  opacity: 0.9;
}
.vc-relword-romaji {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-style: italic;
  color: var(--text-ghost);
  letter-spacing: 0.04em;
  display: none;
}
/* Romaji hidden/shown via parent toggle — same as main word romaji */
#vocab-grid.show-romaji .vc-relword-romaji {
  display: block;
}

.vc-relword-meaning {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.45;
  margin-top: 1px;
}

/* Example sentence inside antonym */
.vc-relword-example {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 5px;
  padding: 6px 8px;
  background: var(--ink-3);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--shu-dim);
}
.vc-relword-ex-jp {
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-wrap: wrap;
  font-family: var(--font-display);
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.55;
}
.vc-relword-ex-reading {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--indigo-light);
  opacity: 0.8;
}
.vc-relword-ex-romaji {
  display: none;
}
#vocab-grid.show-romaji .vc-relword-ex-romaji {
  display: block;
}

/* ── Tombol Tandai & Kartu Dikuasai ──────────────────────── */
.mark-vocab-btn {
  align-self: flex-end;
  margin-top: 2px;
}
.vocab-card.is-mastered .mark-vocab-btn {
  color: var(--gold-dim);
  border-color: var(--gold-dim);
}

/* ── Search Row & Kontrol ─────────────────────────────────── */
#vocab-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) 0;
}
#vocab-search-container {
  flex: 1 1 260px;
  max-width: 420px;
}

/* Tombol romaji */
#vocab-romaji-toggle {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  padding: 6px 12px;
  min-width: 80px;
}
#vocab-romaji-toggle.primary {
  border-color: var(--indigo-light);
  color: var(--indigo-light);
  background: var(--indigo-ghost);
}

/* ── Legenda Penguasaan ───────────────────────────────────── */
.mastery-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: var(--space-2);
}
.mastery-legend__item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-faint);
}
.mastery-legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.mastery-legend__dot--expert {
  background: var(--jade-light);
}
.mastery-legend__dot--mid {
  background: var(--gold-light);
}
.mastery-legend__dot--beginner {
  background: var(--shu-light);
}
.mastery-legend__dot--new {
  background: var(--ink-5);
}
