/* ToT 共通の土台スタイル。サイト共通の /css/common.css の後に読み込む。
   白基調・主操作は青・成功は緑・エラーは赤＋文字。common.css に合わせてダークモードにも対応。 */
:root {
  --tot-surface: #f6f8fb;
  --tot-field-bg: #ffffff;
  --tot-border: #d6dce5;
  --tot-input-border: #9aa5b5;
  --tot-text: #1a2230;
  --tot-muted: #5a6575;
  --tot-primary: #1d5fd1;
  --tot-primary-hover: #164ba8;
  --tot-primary-soft: #e8f0fd;
  --tot-on-primary: #ffffff;
  --tot-success: #157347;
  --tot-success-text: #0f5132;
  --tot-success-soft: #e7f5ee;
  --tot-danger: #b42318;
  --tot-danger-soft: #fdecea;
  --tot-focus: #f2a900;
  --tot-radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tot-surface: #20242b;
    --tot-field-bg: #15181d;
    --tot-border: #3a414c;
    --tot-input-border: #5c6675;
    --tot-text: #e8ecf2;
    --tot-muted: #a7b0bd;
    --tot-primary: #6ea2ff;
    --tot-primary-hover: #8fb7ff;
    --tot-primary-soft: #1d2a40;
    --tot-on-primary: #0b1220;
    --tot-success: #4cc38a;
    --tot-success-text: #9be0bd;
    --tot-success-soft: #15291f;
    --tot-danger: #ff8a7a;
    --tot-danger-soft: #3a1d1a;
  }
}

.tot-main *, .tot-main *::before, .tot-main *::after { box-sizing: border-box; }

.tot-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 16px 64px;
  color: var(--tot-text);
  font-size: 16px;
  line-height: 1.7;
}
.tot-main a { color: var(--tot-primary); }
/* ツールの表示部分。中の2列・1列の切り替えは画面幅ではなくこの幅で決める（@container tot-tool。作業画面の並べて表示の片側でも合う） */
.tot-tool { container: tot-tool / inline-size; }
.tot-main :focus-visible { outline: 3px solid var(--tot-focus); outline-offset: 2px; }

.tot-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.tot-main [hidden] { display: none !important; }

/* ── パンくず ── */
.tot-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--tot-muted);
}
.tot-crumbs li + li::before { content: "›"; margin-right: 6px; }
.tot-crumbs a { color: var(--tot-muted); text-decoration: none; }
.tot-crumbs a:hover { text-decoration: underline; }

/* ── タイトル ── */
.tot-version {
  display: inline-block;
  margin-bottom: 4px;
  padding: 0 8px;
  border: 1px solid var(--tot-border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--tot-muted);
}
.tot-main .tot-open-tab {
  display: inline-flex; align-items: center; min-height: 36px; margin-left: 8px; padding: 2px 12px;
  border: 1px solid var(--tot-primary); border-radius: var(--tot-radius);
  font-size: 14px; font-weight: 600; text-decoration: none; vertical-align: middle;
}
.tot-main .tot-open-tab:hover { background: var(--tot-primary-soft); }
.tot-main .tot-title h1 { margin: 0 0 4px; font-size: 26px; line-height: 1.35; letter-spacing: 0; }
.tot-main .tot-lead { margin: 0 0 12px; color: var(--tot-muted); }

.tot-main .tot-privacy {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 0 0 20px;
  padding: 10px 14px;
  border-radius: var(--tot-radius);
  background: var(--tot-success-soft);
  color: var(--tot-success-text);
  font-size: 14px;
}

.tot-doc { margin-top: 36px; }
.tot-main .tot-doc h2 {
  font-size: 20px;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--tot-border);
}

/* ── ボタン ── */
.tot-btn {
  appearance: none;
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid var(--tot-primary);
  border-radius: var(--tot-radius);
  background: transparent;
  color: var(--tot-primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tot-btn:hover { background: var(--tot-primary-soft); }
.tot-btn-primary { background: var(--tot-primary); color: var(--tot-on-primary); }
.tot-btn-primary:hover { background: var(--tot-primary-hover); }
.tot-btn-quiet { border-color: var(--tot-border); color: var(--tot-muted); }
.tot-btn-quiet:hover { background: var(--tot-surface); }

@media (min-width: 900px) {
  .tot-main { padding: 24px 24px 80px; }
  .tot-main .tot-title h1 { font-size: 30px; }
}

/* eBay の商品説明の編集欄（共通部品。TOT-014・TOT-037）。ビルドで、src/shared/desc/ を読み込むツールの styles.css の先頭に入る。
   編集欄は、コピーする HTML（model.js の designStyles）と同じ大きさ・色で表示する（白い紙。暗い表示でも白）。
   見た目の設定（詳細版）は CSS 変数（--desc-*）で受け取る。変数が無い時は初期値（第1弾の出力と同じ） */

/* ---- 書式ボタン ---- */
.tot-desc-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding: 10px 12px; margin: 0 0 8px;
  border: 1px solid var(--tot-border); border-radius: var(--tot-radius); background: var(--tot-surface);
}
.tot-desc-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.tot-desc-group-label { float: left; margin-right: 2px; padding: 0; font-size: 13px; font-weight: 600; color: var(--tot-muted); }
.tot-desc-font { gap: 4px 10px; }
.tot-desc .tot-desc-btn { min-height: 40px; padding: 4px 12px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.tot-desc .tot-desc-btn:hover { background: var(--tot-primary-soft); }
.tot-desc .tot-desc-btn[aria-pressed="true"] { background: var(--tot-primary); color: var(--tot-on-primary); }
.tot-desc-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, 0.25); background: #222222; }
.tot-desc-swatch[data-swatch="red"] { background: #c62828; }
.tot-desc-swatch[data-swatch="blue"] { background: #1565c0; }
.tot-desc-swatch[data-swatch="green"] { background: #2e7d32; }
.tot-desc-radio { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; font-size: 14px; cursor: pointer; }
.tot-desc-radio input { width: 18px; height: 18px; margin: 0; }

/* ---- 編集欄（白い紙） ---- */
.tot-desc-paper-wrap { position: relative; }
.tot-desc-paper {
  min-height: 320px; max-height: min(70vh, 760px); overflow-y: auto;
  padding: 16px 18px; border: 1px solid var(--tot-input-border); border-radius: var(--tot-radius);
  background: #ffffff; color: #222222;
  font-size: var(--desc-fs, 16px); line-height: var(--desc-lh, 1.7); text-align: left;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  caret-color: #1d5fd1;
}
.tot-desc-paper:focus { outline: 3px solid var(--tot-focus); outline-offset: 1px; }
.tot-desc-paper.is-gothic { font-family: Arial, Helvetica, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif; }
.tot-desc-paper.is-mincho { font-family: "Times New Roman", Times, Georgia, "Hiragino Mincho ProN", "Yu Mincho", serif; }
.tot-desc-paper p { margin: 0 0 var(--desc-pgap, 14px); }
.tot-desc-paper h2 {
  font-size: 22px; line-height: 1.4; font-weight: bold; color: inherit;
  margin: var(--desc-h2-mt, 28px) 0 var(--desc-h2-mb, 12px); padding: var(--desc-h2-pad, 0 0 6px);
  border-bottom: var(--desc-h2-border, 2px solid #d0d7de); background: var(--desc-h2-bg, transparent);
}
.tot-desc-paper h3 {
  font-size: 18px; line-height: 1.4; font-weight: bold; color: inherit;
  margin: var(--desc-h3-mt, 22px) 0 var(--desc-h3-mb, 8px); padding: var(--desc-h3-pad, 0);
  border-bottom: var(--desc-h3-border, 0); background: var(--desc-h3-bg, transparent);
}
.tot-desc-paper > :first-child { margin-top: 0; }
.tot-desc-paper strong { font-weight: bold; }
.tot-desc-paper [data-color="red"] { color: #c62828; }
.tot-desc-paper [data-color="blue"] { color: #1565c0; }
.tot-desc-paper [data-color="green"] { color: #2e7d32; }
/* テンプレートの見出しの印（編集欄だけ。HTML には出ない） */
.tot-desc-paper [data-tpl]::after { content: "テンプレート"; margin-left: 8px; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; vertical-align: middle; color: #5a6575; background: #eef1f5; user-select: none; }
.tot-desc-placeholder { position: absolute; top: 17px; left: 19px; right: 19px; margin: 0; color: #767676; font-size: var(--desc-fs, 16px); line-height: var(--desc-lh, 1.7); pointer-events: none; }

/* ---- 文字数・案内 ---- */
.tot-desc-info { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; margin-top: 4px; }
.tot-desc-count { margin: 0; font-size: 12px; color: var(--tot-muted); font-variant-numeric: tabular-nums; order: 2; margin-left: auto; }
.tot-desc-count.is-over { color: var(--tot-danger); font-weight: 700; }
.tot-desc-omit { margin: 0; font-size: 13px; color: var(--tot-muted); }
.tot-desc-warn { margin: 6px 0 0; padding: 8px 12px; border-left: 4px solid var(--tot-danger); background: var(--tot-danger-soft); font-size: 14px; }
.tot-desc-msg { min-height: 1.5em; margin: 4px 0 0; font-size: 14px; color: var(--tot-muted); }

/* ---- HTMLをコピー ---- */
.tot-desc-copyarea { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--tot-border); }
.tot-desc-copyrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.tot-desc .tot-desc-copy { min-height: 52px; padding: 8px 28px; font-size: 17px; }
.tot-desc-copy-status { margin: 0; font-weight: 700; }
.tot-desc-copy-status.is-ok { color: var(--tot-success-text); }
.tot-desc-copy-status.is-ok::before { content: "✓ "; }
.tot-desc-copy-status.is-error { color: var(--tot-danger); font-weight: 600; }
.tot-desc-outbox { margin-top: 10px; }
.tot-desc-outbox summary { cursor: pointer; font-size: 14px; color: var(--tot-muted); }
.tot-desc-out {
  display: block; width: 100%; box-sizing: border-box; margin-top: 6px; padding: 8px 10px;
  border: 1px solid var(--tot-input-border); border-radius: var(--tot-radius);
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5;
  color: var(--tot-text); background: var(--tot-field-bg); resize: vertical; white-space: pre-wrap; overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .tot-desc-toolbar { padding: 8px; gap: 6px 10px; }
  .tot-desc .tot-desc-btn { padding: 4px 10px; }
  .tot-desc-paper { padding: 12px; min-height: 260px; }
  .tot-desc-placeholder { top: 13px; left: 13px; right: 13px; }
  .tot-desc .tot-desc-copy { width: 100%; }
}

/* 利用状況の計測の設定（src/shared/usage/usage-page.js。画面の下に出し、ツールの操作を妨げない。閉じられる） */
.tot-usage-note { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50; max-width: 720px; max-height: 70vh; overflow: auto; margin: 0 auto; padding: 12px 14px; border: 1px solid var(--tot-border); border-radius: var(--tot-radius); background: var(--tot-field-bg); color: var(--tot-text); font-size: 13px; line-height: 1.6; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); }
.tot-usage-note p { margin: 0 0 6px; }
.tot-usage-title { font-weight: 700; font-size: 14px; }
.tot-usage-state { color: var(--tot-muted); }
.tot-usage-note a { color: var(--tot-primary); }
.tot-usage-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
/* 「許可する」「許可しない」は同じ見た目（どちらかを目立たせない） */
.tot-usage-btn { min-height: 36px; padding: 4px 16px; border: 1px solid var(--tot-input-border); border-radius: 6px; background: var(--tot-surface); color: var(--tot-text); font: inherit; font-weight: 600; cursor: pointer; }
.tot-usage-btn:focus-visible, .tot-usage-note-close:focus-visible { outline: 3px solid var(--tot-focus); outline-offset: 2px; }
.tot-usage-note-close { margin-left: auto; padding: 2px 10px; border: 1px solid var(--tot-input-border); border-radius: 6px; background: transparent; color: var(--tot-text); font: inherit; cursor: pointer; }

/* TOT-014 eBay商品説明を作成。上に書式ボタン、中央に編集欄、下に「HTMLをコピー」。
   編集欄・書式ボタン・コピーの見た目は共通部品（src/shared/desc/editor.css。ビルドでこのファイルの前に入る） */
.tot-desc { max-width: 900px; }

/* パソコン推奨の案内（TOT-036 の .tot-sh-device と同じ見た目） */
.tot-desc-device { margin: 0 0 12px; padding: 8px 12px; border-left: 4px solid var(--tot-primary); background: var(--tot-primary-soft); border-radius: var(--tot-radius); font-size: 14px; }

/* ---- 使い方（作業タブでは下、単独ページでも下） ---- */
.tot-desc-help { margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--tot-border); font-size: 14px; }
.tot-desc-help-title { margin: 0 0 6px; font-size: 15px; }
.tot-desc-save { margin: 8px 0 0; color: var(--tot-muted); }
.tot-privacy-short { margin: 0 0 12px; font-size: 13px; color: var(--tot-muted); }
.tot-rules { padding-left: 1.2em; margin: 0; }
.tot-rules li { margin-bottom: 4px; }
.tot-noscript { color: var(--tot-danger); font-weight: 700; }
