/* ============================================================================
 * LessonNote — 訂正（先生が直した訳）まわりの見た目
 *   ・ui/corrections.js の一覧パネル（.ln-corr）
 *   ・ui/notes.js が出す「✎ 直した訳」の印・意味の直し欄
 *
 *   app.css は触らない（他の担当と取り合わないため）。ここだけで完結させる。
 *   色は app.css の CSS変数を使い、無い環境でもフォールバックで成立させる。
 * ========================================================================== */

/* ---------- 一覧パネル（オーバーレイ） ---------- */

.ln-corr {
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ln-corr[hidden] { display: none; }

.ln-corr .ln-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 14, .42);
}

.ln-corr__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1080px, 94vw);
  height: min(760px, 88vh);
  background: var(--surface, #fff);
  color: var(--fg, #1a1a1a);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
  overflow: hidden;
}

/* ---------- ヘッダー ---------- */

.ln-corr__head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line, rgba(0, 0, 0, .12));
  background: var(--surface-2, #FCF5EF);
}
.ln-corr__title {
  font-weight: 800;
  font-size: 16px;
  line-height: 1.35;
  color: var(--brand, #C8102E);
  white-space: nowrap;
}
.ln-corr__title small {
  display: block;
  font-weight: 500;
  font-size: 11.5px;
  color: var(--fg-3, #6b6b6b);
  white-space: normal;
  max-width: 34ch;
}
.ln-corr__tabs { display: flex; gap: 6px; }
.ln-corr__tabs .ln-tab {
  appearance: none;
  border: 1px solid var(--line, rgba(0, 0, 0, .14));
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  cursor: pointer;
}
.ln-corr__tabs .ln-tab.is-on {
  background: var(--brand, #C8102E);
  border-color: var(--brand, #C8102E);
  color: #fff;
}
.ln-corr__search {
  flex: 1 1 auto;
  min-width: 100px;
  border: 1px solid var(--line, rgba(0, 0, 0, .16));
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  background: var(--surface, #fff);
  color: inherit;
}
.ln-corr__close {
  flex: none;
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 8px;
}
.ln-corr__close:hover { background: rgba(0, 0, 0, .07); }

/* ---------- 本文（表） ---------- */

.ln-corr__body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 0;
}

.ln-corr__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ln-corr__table th,
.ln-corr__table td {
  text-align: left;
  vertical-align: top;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line, rgba(0, 0, 0, .08));
}
.ln-corr__table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface, #fff);
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-2, #444);
  white-space: nowrap;
  border-bottom: 2px solid var(--line, rgba(0, 0, 0, .14));
}
.ln-corr__table th.is-sortable { cursor: pointer; user-select: none; }
.ln-corr__table th.is-sortable:hover { color: var(--brand, #C8102E); }
.ln-corr__table tbody tr:hover { background: rgba(200, 16, 46, .04); }

.ln-corr__src { font-weight: 600; max-width: 30ch; }
.ln-corr__lang {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  background: var(--surface-2, #FBE4E6);
  color: var(--brand, #C8102E);
  vertical-align: 1px;
}
.ln-corr__note {
  display: block;
  font-weight: 400;
  font-size: 11.5px;
  color: var(--fg-3, #6b6b6b);
}
.ln-corr__from { max-width: 26ch; color: var(--fg-3, #6b6b6b); text-decoration: line-through; }
.ln-corr__to { max-width: 26ch; font-weight: 700; color: #1E8449; }
/* 数字と操作列は右寄せ。td を付けないと上の td 一括指定に負ける。 */
.ln-corr__table td.ln-corr__kind,
.ln-corr__table td.ln-corr__hits,
.ln-corr__table td.ln-corr__date { white-space: nowrap; }
.ln-corr__table th.ln-corr__hits-h,
.ln-corr__table td.ln-corr__hits { text-align: right; font-variant-numeric: tabular-nums; }
.ln-corr__table td.ln-corr__date { color: var(--fg-3, #6b6b6b); font-variant-numeric: tabular-nums; }
.ln-corr__table td.ln-corr__act { text-align: right; white-space: nowrap; }

.ln-corr__empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--fg-3, #6b6b6b);
  line-height: 1.9;
}
.ln-corr__empty strong { color: var(--fg, #1a1a1a); }

/* ---------- フッター ---------- */

.ln-corr__foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--line, rgba(0, 0, 0, .12));
  background: var(--surface-2, #FCF5EF);
  font-size: 12.5px;
}
.ln-corr__spacer { flex: 1 1 auto; }
.ln-corr__count { color: var(--fg-3, #6b6b6b); font-variant-numeric: tabular-nums; }
.ln-corr__file { display: none; }

/* ---------- ノート側（notes.js が出す印・編集欄） ---------- */

.ln-chip-corrected {
  appearance: none;
  border: 1px solid rgba(30, 132, 73, .35);
  background: rgba(30, 132, 73, .10);
  color: #1E8449;
  font-weight: 700;
  cursor: pointer;
}
.ln-chip-corrected:hover { background: rgba(30, 132, 73, .18); }
.ln-chip-corrected.ln-chip-mini { font-size: 10.5px; padding: 0 6px; }

.ln-vocab-meaning.is-corrected {
  color: #1E8449;
  font-weight: 700;
  text-decoration: underline dotted rgba(30, 132, 73, .5);
  text-underline-offset: 3px;
}
.ln-vocab-pen {
  opacity: .45;
  padding: 0 4px;
}
.ln-vocab-item:hover .ln-vocab-pen { opacity: 1; }

/* 「元の訳に戻す／この訂正を消す」の小さなメニュー */
.ln-corr-menu {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: 8px;
  padding: 5px 8px;
  border: 1px solid var(--line, rgba(0, 0, 0, .14));
  border-radius: 10px;
  background: var(--surface, #fff);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
}

/* 語彙カードの意味を直す欄 */
.ln-vocab-edit-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line, rgba(0, 0, 0, .14));
  border-radius: 10px;
  background: var(--surface-2, #FCF5EF);
}
.ln-vocab-edit-input {
  flex: 1 1 180px;
  min-width: 140px;
  border: 1px solid var(--line, rgba(0, 0, 0, .18));
  border-radius: 8px;
  padding: 5px 8px;
  font: inherit;
  font-size: 13px;
  background: var(--surface, #fff);
  color: inherit;
}

/* 「この訳を次回から使う」チェックボックス */
.ln-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--fg-2, #444);
  cursor: pointer;
  user-select: none;
}
.ln-check input { margin: 0; }
.ln-dst-edit-keep { margin-left: 4px; }

/* 印刷（PDF）には訂正の操作UIを出さない。訳そのものは出る。 */
@media print {
  .ln-corr,
  .ln-corr-menu,
  .ln-vocab-pen,
  .ln-vocab-edit-box,
  .ln-check { display: none !important; }
}
