/* 日本語修正案パネル（元サイトのデザインには触れない。すべて .tei- で始まる名前） */
.tei-root, .tei-root * { box-sizing: border-box; }
.tei-root {
  --tei-ink: #16130f; --tei-paper: #fbf8f2; --tei-line: #e6dfd2; --tei-mute: #6d655a;
  --tei-new: #0f6b4f; --tei-new-bg: #e8f4ee; --tei-old: #9a3b2e; --tei-old-bg: #f8ebe7; --tei-mark: #ffe58a;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  color: var(--tei-ink); font-size: 14px; line-height: 1.7; letter-spacing: .01em;
}
.tei-pill {
  position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 2147483000;
  display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 12px; border-radius: 12px;
  background: var(--tei-ink); color: #fff; border: 0; cursor: pointer; font: inherit; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,.28), 0 2px 6px rgba(0,0,0,.2); transition: transform .2s ease;
}
.tei-pill:hover { transform: translateY(-2px); }
.tei-root .tei-pill, .tei-root .tei-pill * { color: #fff !important; font-family: inherit !important; }
.tei-pill b { font-weight: 700; font-size: 13px; }
.tei-pill > span:nth-child(2) { text-align: left; }
.tei-pill small { display: block; font-size: 11px; opacity: .7; line-height: 1.3; }
.tei-dot { width: 10px; height: 10px; border-radius: 50%; background: #3ddc97; flex: none; box-shadow: 0 0 0 3px rgba(61,220,151,.25); }
.tei-root[data-mode="orig"] .tei-dot { background: #ff7a5c; box-shadow: 0 0 0 3px rgba(255,122,92,.25); }
.tei-count { background: rgba(255,255,255,.14); border-radius: 6px; padding: 1px 7px; font-size: 12px; font-variant-numeric: tabular-nums; }

.tei-shade { position: fixed; inset: 0; background: rgba(20,16,10,.35); z-index: 2147483001; opacity: 0; pointer-events: none; transition: opacity .25s; }
.tei-open .tei-shade { opacity: 1; pointer-events: auto; }
.tei-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 2147483002;
  background: var(--tei-paper); border-left: 1px solid var(--tei-line);
  display: flex; flex-direction: column; transform: translateX(105%); transition: transform .3s cubic-bezier(.2,.8,.2,1);
  padding-top: env(safe-area-inset-top, 0px);
}
.tei-open .tei-panel { transform: none; }
.tei-head { padding: 22px 22px 16px; border-bottom: 1px solid var(--tei-line); }
.tei-head h2 { margin: 0; font-size: 18px; line-height: 1.45; font-weight: 700; }
.tei-head .tei-en { color: var(--tei-mute); font-size: 12px; margin-top: 2px; }
.tei-close { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--tei-line); background: #fff; cursor: pointer; font-size: 18px; line-height: 1; color: var(--tei-ink); }
.tei-lead { margin: 12px 0 0; font-size: 13px; color: #3d372f; }
.tei-lead span { display: block; color: var(--tei-mute); font-size: 12px; margin-top: 4px; line-height: 1.55; }
.tei-stats { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.tei-stat { background: #fff; border: 1px solid var(--tei-line); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--tei-mute); }
.tei-stat b { color: var(--tei-ink); font-size: 16px; margin-right: 2px; font-variant-numeric: tabular-nums; }

.tei-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px 22px; border-bottom: 1px solid var(--tei-line); }
.tei-btn { font: inherit; font-size: 12.5px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--tei-line); background: #fff; color: var(--tei-ink); cursor: pointer; text-align: left; line-height: 1.35; }
.tei-btn small { display: block; color: var(--tei-mute); font-size: 11px; }
.tei-btn[aria-pressed="true"] { background: var(--tei-ink); color: #fff; border-color: var(--tei-ink); }
.tei-btn[aria-pressed="true"] small { color: rgba(255,255,255,.7); }
.tei-btn.tei-mode { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
.tei-switch { display: inline-flex; border: 1px solid var(--tei-line); border-radius: 7px; overflow: hidden; flex: none; }
.tei-switch i { font-style: normal; padding: 4px 10px; font-size: 12px; }
.tei-root[data-mode="new"] .tei-switch i:last-child, .tei-root[data-mode="orig"] .tei-switch i:first-child { background: var(--tei-ink); color: #fff; }

.tei-tabs { display: flex; gap: 4px; padding: 12px 22px 0; }
.tei-tab { font: inherit; font-size: 12.5px; border: 0; background: none; padding: 6px 10px 9px; cursor: pointer; color: var(--tei-mute); border-bottom: 2px solid transparent; }
.tei-tab[aria-selected="true"] { color: var(--tei-ink); border-bottom-color: var(--tei-ink); font-weight: 700; }
.tei-list { overflow-y: auto; padding: 6px 22px 40px; flex: 1; overscroll-behavior: contain; }
.tei-item { padding: 16px 0; border-bottom: 1px solid var(--tei-line); }
.tei-item:last-child { border-bottom: 0; }
.tei-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.tei-where { font-size: 11px; color: var(--tei-mute); letter-spacing: .04em; }
.tei-star { white-space: nowrap; font-size: 10.5px; color: #8a5a00; background: #fff3cf; border-radius: 4px; padding: 1px 6px; margin-left: 6px; }
.tei-go { font: inherit; font-size: 11px; color: var(--tei-ink); background: none; border: 1px solid var(--tei-line); border-radius: 6px; padding: 2px 8px; cursor: pointer; white-space: nowrap; }
.tei-row { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: start; margin-top: 6px; }
.tei-tag { font-size: 10.5px; font-weight: 700; text-align: center; border-radius: 4px; padding: 2px 0; margin-top: 3px; }
.tei-old .tei-tag { color: var(--tei-old); background: var(--tei-old-bg); }
.tei-new .tei-tag { color: var(--tei-new); background: var(--tei-new-bg); }
.tei-old .tei-txt { color: #7b736a; font-size: 13px; }
.tei-new .tei-txt { color: var(--tei-ink); font-weight: 600; }
.tei-txt { white-space: pre-line; word-break: break-word; }
.tei-ph { font-family: ui-monospace, Menlo, monospace; font-size: 11px; background: #efe9dd; border-radius: 4px; padding: 0 4px; color: var(--tei-mute); font-weight: 400; }
.tei-why { margin-top: 10px; background: #fff; border: 1px solid var(--tei-line); border-radius: 8px; padding: 9px 11px; font-size: 12.5px; color: #3d372f; }
.tei-why span { display: block; color: var(--tei-mute); font-size: 11.5px; margin-top: 3px; line-height: 1.55; }
.tei-empty { color: var(--tei-mute); font-size: 13px; padding: 24px 0; }

/* ページ上の「修正した場所」の印 */
.tei-marked { background-color: rgba(255, 204, 51, .26) !important; box-shadow: 0 0 0 6px rgba(255, 204, 51, .26), inset 3px 0 0 #f0b400 !important; border-radius: 3px; }
.tei-flash { outline: 3px solid #ffb000 !important; outline-offset: 6px; border-radius: 4px; transition: outline-color .6s; }

@media (max-width: 640px) {
  .tei-panel { top: auto; height: 86vh; width: 100vw; border-left: 0; border-top: 1px solid var(--tei-line); border-radius: 16px 16px 0 0; transform: translateY(105%); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .tei-head { padding: 18px 18px 14px; }
  .tei-tools, .tei-tabs, .tei-list { padding-left: 18px; padding-right: 18px; }
  .tei-pill { left: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); padding: 9px 13px 9px 11px; }
  .tei-pill small { display: none; }
}
