/* t-tech ツール共通スタイル（トップページの色に合わせる） */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #5f6368;
  --border: #e0e0e0;
  --accent: #0d7a5f;
  --accent-fg: #ffffff;
  --card-bg: #f7f9f8;
  --input-bg: #ffffff;
  --error: #c5221f;
  --error-bg: #fce8e6;
  --warn-bg: #fef7e0;
  --ok: #137333;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --fg: #eaecee;
    --muted: #9aa0a6;
    --border: #2e3336;
    --accent: #4fd1a5;
    --accent-fg: #0b1f18;
    --card-bg: #1b1f22;
    --input-bg: #101315;
    --error: #f28b82;
    --error-bg: #3c1f1e;
    --warn-bg: #3a3420;
    --ok: #81c995;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.75;
}
a { color: var(--accent); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }

.site-header { border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.site-header .brand { font-weight: bold; color: var(--fg); text-decoration: none; white-space: nowrap; }
.site-header .brand img { vertical-align: middle; margin: -4px 8px 0 0; }
.site-header .brand span { color: var(--accent); }
.breadcrumb { font-size: 0.85rem; color: var(--muted); margin: 14px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px; }
.breadcrumb li + li::before { content: "›"; margin-right: 4px; }
.breadcrumb a { color: var(--muted); }

h1 { font-size: 1.6rem; line-height: 1.4; margin: 0.5em 0 0.3em; }
h2 { font-size: 1.25rem; margin: 2.2em 0 0.6em; padding-bottom: 0.3em; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.05rem; margin: 1.6em 0 0.4em; }
.lead { color: var(--muted); margin: 0 0 1.2em; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* フォーム */
label.field { display: block; margin: 0 0 12px; }
.field-label { display: block; font-size: 0.85rem; font-weight: bold; margin-bottom: 4px; }
.field-help { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 4px; line-height: 1.5; }
input[type="text"], input[type="url"], input[type="number"], input[type="search"], input[type="date"], input[type="password"], input[type="email"], input[type="tel"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px; /* iOS のズーム防止 */
  color: var(--fg);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  min-height: 44px;
}
textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
input[type="color"] { width: 52px; height: 44px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--input-bg); }
label.check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 0.92rem; cursor: pointer; }
label.check { flex-wrap: wrap; }
label.check .field-help { flex-basis: 100%; margin: -8px 0 8px 28px; }
label.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 12px; }
@media (max-width: 600px) {
  h1 { font-size: 1.3rem; }
  .lead { font-size: 0.9rem; }
  h2 { font-size: 1.12rem; }
}
@media (max-width: 480px) {
  .row4 { grid-template-columns: 1fr 1fr; }
  .row3 { grid-template-columns: 1fr 1fr; }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px;
  font: inherit; font-size: 0.95rem; font-weight: bold;
  border-radius: 6px; border: 1px solid var(--border);
  background: var(--input-bg); color: var(--fg);
  cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }

details.box { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); margin: 12px 0; }
details.box > summary { cursor: pointer; padding: 10px 14px; min-height: 44px; display: flex; align-items: center; font-weight: bold; list-style: none; }
details.box > summary::-webkit-details-marker { display: none; }
details.box > summary::before { content: "▸"; margin-right: 8px; color: var(--accent); transition: transform 0.15s; }
details.box[open] > summary::before { transform: rotate(90deg); }
details.box > .box-body { padding: 4px 14px 14px; }

.msg { border-radius: 6px; padding: 8px 12px; font-size: 0.88rem; margin: 8px 0; line-height: 1.6; }
.msg.error { background: var(--error-bg); color: var(--error); }
.msg.warn { background: var(--warn-bg); }
.msg.ok { color: var(--ok); padding-left: 0; }
.msg:empty { display: none; }

table.data { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
table.data th, table.data td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
table.data th { background: var(--card-bg); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 説明文 */
.article p, .article li { font-size: 0.95rem; }
.article dt { font-weight: bold; margin-top: 1em; }
.article dd { margin: 0.2em 0 0 0; }
.note { font-size: 0.85rem; color: var(--muted); }

/* アフィリエイト（もしもアフィリエイト「かんたんリンク」）枠 */
.tt-aff { margin: 24px 0; }
.tt-aff:empty { display: none; }
.tt-aff-label { display: inline-block; font-size: 0.72rem; font-weight: normal; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 6px; margin-right: 8px; vertical-align: 1px; }
.tt-aff-heading { font-size: 0.9rem; font-weight: bold; margin: 0 0 6px; }
.tt-aff-item { margin: 0 0 8px; min-height: 112px; } /* カード表示前の「リンク」から高さが大きく変わらないように */
/* かんたんリンクのカードを小さく横並びにする（スマホで画面いっぱいの縦長カードにならないように） */
.tt-aff .easyLink-box { display: flex !important; align-items: center; gap: 12px; max-width: none !important; margin: 0 !important; padding: 10px 12px !important; border: 1px solid var(--border) !important; border-radius: var(--radius); background: var(--card-bg) !important; box-shadow: none !important; }
.tt-aff .easyLink-img { flex: 0 0 88px !important; width: 88px !important; max-width: 88px !important; margin: 0 !important; padding: 0 !important; }
.tt-aff .easyLink-img-box { width: 88px !important; height: 88px !important; margin: 0 !important; background: #fff; border-radius: 6px; overflow: hidden; }
.tt-aff .easyLink-img-box img.easyLink-img-pht { width: 88px !important; height: 88px !important; max-width: none !important; max-height: none !important; object-fit: contain; }
.tt-aff .easyLink-arrow-left, .tt-aff .easyLink-arrow-right, .tt-aff .easyLink-info-maker, .tt-aff .easyLink-info-model { display: none !important; }
.tt-aff .easyLink-info { flex: 1 1 auto; min-width: 0; width: auto !important; margin: 0 !important; padding: 0 !important; }
.tt-aff .easyLink-info-name { margin: 0 0 8px !important; font-size: 0.85rem !important; line-height: 1.4 !important; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tt-aff .easyLink-info-name a { color: var(--fg) !important; }
.tt-aff .easyLink-info-btn { display: flex !important; flex-wrap: wrap; gap: 6px; margin: 0 !important; }
.tt-aff .easyLink-info-btn a { width: auto !important; min-width: 0 !important; margin: 0 !important; padding: 6px 14px !important; font-size: 0.8rem !important; }
.tt-aff .easyLink-info-btn span { display: none !important; }

.site-footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 20px 0 40px; color: var(--muted); font-size: 0.82rem; }
.site-footer p { margin: 0.3em 0; }
.site-footer a { color: var(--muted); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* 「?」で開く補足説明 */
.tip-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-left: 6px; padding: 0; vertical-align: middle;
  border-radius: 50%; border: 1px solid var(--border); background: var(--input-bg); color: var(--muted);
  font: inherit; font-size: 0.75rem; font-weight: bold; line-height: 1; cursor: pointer;
  position: relative;
}
.tip-btn::after { content: ""; position: absolute; inset: -11px; } /* タップ領域を 44px に広げる */
.tip-btn[aria-expanded="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.tip-pop {
  display: block; margin: 4px 0 8px; padding: 8px 12px;
  font-size: 0.85rem; font-weight: normal; line-height: 1.6; color: var(--fg);
  background: var(--card-bg); border: 1px solid var(--accent); border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.tip-pop[hidden] { display: none; }
label.check .tip-pop { flex-basis: 100%; margin-left: 28px; }

/* ===== 以下、バーコード以外のツールでも使う共通部品 ===== */
[hidden] { display: none !important; }
:root { --code-bg: #e8f5f0; --code-border: #b7dfd0; --code-ring: rgba(13, 122, 95, 0.25); --hl-bg: #fff4c2; }
@media (prefers-color-scheme: dark) { :root { --code-bg: #15302a; --code-border: #245245; --code-ring: rgba(79, 209, 165, 0.3); --hl-bg: #4a4320; } }

/* 入力（左）と結果（右）の2カラム。スマホは縦に並ぶ */
.tool2 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 860px) { .tool2 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px 24px; } }

/* 手順の番号 */
.field-label.step { display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.field-label.step b { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); font-size: 0.85rem; flex: none; }

/* いちばん目立たせる入力欄 */
.main-field { padding: 12px; border-radius: var(--radius); background: var(--code-bg); border: 1px solid var(--code-border); margin-bottom: 12px; }
.main-field input, .main-field select { font-size: 20px; font-weight: bold; border: 2px solid var(--accent); min-height: 52px; }
.main-field input:focus, .main-field select:focus { outline: none; box-shadow: 0 0 0 4px var(--code-ring); }

/* 切り替えボタン */
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { min-height: 44px; min-width: 72px; padding: 6px 14px; font: inherit; font-size: 0.92rem; color: var(--fg); background: var(--input-bg); border: 0; border-left: 1px solid var(--border); cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button[aria-checked="true"], .seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); font-weight: bold; }

.linkish { background: none; border: 0; padding: 6px 0; min-height: 36px; font: inherit; font-size: 0.85rem; color: var(--accent); text-decoration: underline; cursor: pointer; }
.btn.armed { border-color: var(--error); color: var(--error); }

/* 結果の大きな表示 */
.result-main { font-size: 1.6rem; font-weight: bold; line-height: 1.4; margin: 0 0 4px; }
.result-main small { font-size: 0.6em; font-weight: normal; color: var(--muted); }
.result-sub { color: var(--muted); font-size: 0.9rem; margin: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 12px 0 0; font-size: 0.95rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: bold; }

/* 表の強調行 */
tr.hl > td, tr.hl > th { background: var(--hl-bg); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { display: inline-block; font-size: 0.75rem; line-height: 1.5; padding: 0 6px; border-radius: 4px; border: 1px solid var(--border); white-space: nowrap; }
.tag.strong { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* 解説（見出しを押すと開く） */
.article-title { border-bottom: 0; margin-bottom: 0.4em; }
details.acc { margin: 8px 0; }
details.acc > summary h2 { display: inline; font-size: 1.02rem; margin: 0; padding: 0; border: 0; }
details.acc .box-body > :first-child { margin-top: 0.4em; }
details.acc .tt-aff { margin: 12px 0; }

/* 関連ツール */
.related { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: 8px 0 0; padding: 0; list-style: none; }
.related a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); text-decoration: none; color: var(--fg); font-size: 0.92rem; }
.related a:hover { border-color: var(--accent); }

@media print {
  .no-print, .site-header, .site-footer, .tt-aff, .breadcrumb { display: none !important; }
  body { background: #fff; color: #000; }
  /* ダークモードのまま印刷しても読めるように、明るい配色に戻す */
  :root { color-scheme: light; --bg: #fff; --fg: #1a1a1a; --muted: #5f6368; --border: #ccc; --accent: #0d7a5f; --accent-fg: #fff; --card-bg: #fff; --input-bg: #fff; --error: #c5221f; --error-bg: #fce8e6; --warn-bg: #fef7e0; --ok: #137333; --code-bg: #e8f5f0; --code-border: #b7dfd0; --hl-bg: #fff4c2; }
}

/* アイコン（assets/icons.svg の symbol を <svg class="ico"><use href="…#id"></use></svg> で使う。Lucide, ISC License） */
.ico { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.related .ico { color: var(--accent); }
.tool-ico { width: 44px; height: 44px; padding: 10px; box-sizing: border-box; border-radius: 12px; color: var(--accent); background: rgba(13, 122, 95, 0.12); background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* 使い方ガイド（/tools/guide/） */
.guide-meta { font-size: 0.8rem; color: var(--muted); margin: 0 0 8px; }
.guide-answer { padding: 12px 14px; border-left: 4px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; background: var(--card-bg); margin: 0 0 14px; }
.guide-answer p { margin: 0; }
.guide-cta { margin: 14px 0 8px; }
.guide-cta .btn { min-width: min(320px, 100%); }
.guide h2 { margin-top: 1.8em; }
.guide ol li, .guide ul li { margin: 0.3em 0; }
.guide .table-scroll { margin: 10px 0; }
.guide-links { font-size: 0.9rem; margin: 8px 0 0; }
