/* Japanese names review (2026-10-19), pos/static/ja_review.js.
   Colors are the tokens in style.css's three theme blocks (--jar-*), so
   light, dark and the explicit Dark choice all follow. Phone first. */

#modal:has(> .jar-screen) {
  width: min(720px, calc(100vw - 16px));
  max-width: 720px;
  min-width: 0;
  max-height: 92vh;
  margin: 8px auto;
  padding: 0 18px 18px;
}
.jar-screen { min-width: 0; }

/* Title and progress stay in view while the list scrolls. */
.jar-head {
  position: sticky; top: 0; z-index: 2;
  margin: 0 -18px; padding: 14px 18px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
}
.jar-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.jar-title-row h3 { margin: 0; font-size: 1.15rem; }
#modal .jar-close {
  min-height: 40px; min-width: 40px; padding: 0; margin: 0;
  font-size: 1.1rem; line-height: 1; flex: 0 0 auto;
}
.jar-progress-text { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin: 8px 0 6px; }
.jar-progress-text span { color: var(--text-muted); font-size: 0.9rem; }
.jar-progress-bar { height: 8px; border-radius: 999px; background: var(--jar-bar-off); overflow: hidden; }
.jar-progress-bar span { display: block; height: 100%; background: var(--jar-high); border-radius: 999px; transition: width 0.25s; }
.jar-screen > .field-help { margin: 12px 0 6px; color: var(--text-muted); font-size: 0.92rem; }

/* Filter bubbles: two rows of four, the count under each label, so all
   eight fit across a phone without scrolling sideways. */
.jar-frow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 3px 0; }
#modal .jar-frow .bubble {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 50px; padding: 4px 4px; margin: 0; border-radius: 14px;
  font-size: 0.9rem; line-height: 1.15; text-align: center; white-space: normal; min-width: 0;
}
.jar-fl { display: inline-flex; align-items: center; gap: 5px; }
.jar-n { font-variant-numeric: tabular-nums; opacity: 0.75; font-size: 0.8em; font-weight: 600; }

/* The 3-bar signal: filled bars in the tier's color, the rest faint. */
.jar-sig { flex: 0 0 auto; display: block; }
.jar-sig rect.off { fill: var(--jar-bar-off); }
.jar-badge.low .jar-sig rect.on, .bubble[data-key="low"] .jar-sig rect.on { fill: var(--jar-low); }
.jar-badge.medium .jar-sig rect.on, .bubble[data-key="medium"] .jar-sig rect.on { fill: var(--jar-med); }
.jar-badge.high .jar-sig rect.on, .bubble[data-key="high"] .jar-sig rect.on { fill: var(--jar-high); }
.jar-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 7px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  border: 1px solid currentColor; flex: 0 0 auto;
}
.jar-badge.low { background: var(--jar-low-bg); color: var(--jar-low-ink); }
.jar-badge.medium { background: var(--jar-med-bg); color: var(--jar-med-ink); }
.jar-badge.high { background: var(--jar-high-bg); color: var(--jar-high-ink); }

/* One card per name. */
#jar-list { margin-top: 8px; }
.jar-row {
  border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 12px 14px; margin: 0 0 10px; background: var(--surface);
}
.jar-row.is-flagged { border-color: var(--jar-med); box-shadow: inset 4px 0 0 var(--jar-med); }
.jar-row.is-approved { background: var(--surface-sunken); }
.jar-row.is-saving { opacity: 0.55; pointer-events: none; }
.jar-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jar-en { font-weight: 600; overflow-wrap: anywhere; }
.jar-unit {
  font-size: 0.75rem; font-weight: 500; color: var(--text-muted);
  border: 1px solid var(--border-soft); border-radius: 6px; padding: 0 6px; margin-left: 2px; white-space: nowrap;
}
.jar-ja {
  font-size: 1.55rem; line-height: 1.3; font-weight: 600; margin: 8px 0 6px; overflow-wrap: anywhere;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
}
.jar-row.is-approved .jar-ja { font-size: 1.25rem; margin: 6px 0 4px; }
.jar-link { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.jar-link b { color: var(--text); font-weight: 600; }
.jar-link.none span { color: var(--jar-low-ink); font-weight: 600; }
#modal .jar-mini {
  min-height: 32px; padding: 3px 12px; margin: 0; font-size: 0.85rem;
  border-color: var(--bubble-edge);
}
.jar-lbl { display: block; font-size: 0.78rem; color: var(--text-muted); margin: 0 0 4px; }
.jar-alts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 6px; }
.jar-alts .jar-lbl { width: 100%; margin: 0; }
#modal .jar-chip {
  min-height: 36px; padding: 4px 12px; margin: 0; font-size: 0.95rem;
  border: 1px dashed var(--bubble-edge); border-radius: 999px; background: var(--surface);
}
#modal .jar-chip:hover { background: var(--surface-hover); border-style: solid; }
.jar-src { font-size: 0.75rem; color: var(--text-muted); margin: 4px 0; overflow-wrap: anywhere; }
.jar-src a { color: inherit; text-decoration: underline; }
.jar-flag { font-size: 0.85rem; font-weight: 600; color: var(--jar-med-ink); margin-top: 6px; }
.jar-note {
  font-size: 0.88rem; margin: 6px 0 0; padding: 6px 10px; border-radius: 8px;
  background: var(--jar-med-bg); color: var(--jar-med-ink); overflow-wrap: anywhere;
}
.jar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
#modal .jar-big { min-height: 52px; margin: 0; font-size: 1.02rem; font-weight: 600; padding: 8px 10px; }
#modal .jar-correct { background: var(--jar-high); border-color: var(--jar-high); color: var(--jar-on-high); }
#modal .jar-correct:hover { filter: brightness(1.06); }
#modal .jar-unsure { border-color: var(--jar-med); }
.jar-done { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.jar-ok-mark { color: var(--jar-high-ink); font-weight: 600; font-size: 0.88rem; }
.jar-editor { margin-top: 10px; }
#modal .jar-text, #modal .jar-notebox {
  width: 100%; box-sizing: border-box; padding: 10px; margin: 0 0 8px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
  font: inherit;
}
#modal .jar-text { font-size: 1.25rem; }
.jar-editor > .jar-mini { margin-top: 8px; }
.jar-picker { margin-top: 6px; padding: 8px; border: 1px solid var(--border-soft); border-radius: 10px; }
#modal .jar-search {
  width: 100%; box-sizing: border-box; padding: 9px 10px; margin: 0 0 6px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit;
}
.jar-results { display: flex; flex-direction: column; gap: 4px; }
#modal .jar-result {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left;
  border-radius: 8px; margin: 0; padding: 6px 10px; min-height: 44px; font-size: 0.95rem;
}
.jar-result small { color: var(--text-muted); font-size: 0.75rem; }
.jar-picker-actions { display: flex; gap: 6px; margin-top: 6px; }
.jar-picker-actions button { margin: 0; min-height: 36px; padding: 4px 14px; font-size: 0.9rem; }
.jar-muted { color: var(--text-muted); }
.jar-empty { text-align: center; padding: 24px 0; }

/* Wider screens (iPad): a little more room around the name. */
@media (min-width: 700px) {
  #modal:has(> .jar-screen) { padding: 0 24px 24px; }
  .jar-head { margin: 0 -24px; padding: 16px 24px 12px; }
  .jar-row { padding: 14px 18px; }
  .jar-ja { font-size: 1.7rem; }
  .jar-actions { max-width: 460px; }
}
