/* =====================
   WebTools - 共通スタイル v3
   案C：バタースコッチ × Zen Maru Gothic
   ===================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #fdf6ec;
  --surface:   #ffffff;
  --surface2:  #fdf0e0;
  --border:    #eddfc8;
  --border2:   #ddc9a8;
  --text:      #3a3028;
  --text2:     #7a6a58;
  --text3:     #b8a898;
  --accent:    #e07b54;
  --accent-bg: #fef0e8;
  --accent-h:  #c96840;
  --success:   #4a9e6e;
  --error:     #c0392b;
  --ad-bg:     #f5e8d4;
  --font:      'Zen Maru Gothic', 'DM Sans', sans-serif;
  --mono:      'DM Mono', 'Courier New', monospace;
  --r:         14px;
  --r-sm:      8px;
  --shadow:    0 1px 4px rgba(180,120,60,0.08), 0 1px 2px rgba(180,120,60,0.05);
  --shadow-md: 0 4px 16px rgba(180,120,60,0.12);
  --max:       900px;
  --t:         0.15s ease;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── ヘッダー ── */
.site-header {
  background: rgba(253,246,236,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
}
.logo-mark {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 100px;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: #fff;
}
.site-logo:hover { text-decoration: none; }
.logo-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 100px;
  transition: background var(--t), color var(--t);
}
.site-nav a:hover { background: var(--accent-bg); color: var(--accent); text-decoration: none; }

/* ── 広告バナー ── */
.ad-banner {
  background: var(--ad-bg);
  border-bottom: 1px solid var(--border);
  text-align: center;
  padding: 10px;
  font-size: 11px;
  color: var(--text3);
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── ページラッパー ── */
.page-wrapper {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 20px 52px;
}

/* ── パンくず ── */
.breadcrumb {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb a { color: var(--text3); }
.breadcrumb a:hover { color: var(--accent); text-decoration: none; }

/* ── ページタイトル ── */
.tool-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 24px; }
.tool-icon {
  width: 46px; height: 46px;
  background: var(--accent-bg);
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.tool-title { font-size: 22px; font-weight: 700; margin-bottom: 3px; color: var(--text); }
.tool-desc { font-size: 13px; color: var(--text2); }

/* ── カード ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 14px;
}
.card-body { padding: 18px 20px; }

/* ── 2カラムレイアウト ── */
.tool-split { display: grid; grid-template-columns: 1fr 1fr; }
.tool-pane { padding: 18px 20px; }
.tool-pane + .tool-pane { border-left: 1px solid var(--border); }
.pane-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text3);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── テキストエリア・インプット ── */
textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface2);
  color: var(--text);
  resize: vertical;
  outline: none;
  line-height: 1.6;
  transition: border-color var(--t), box-shadow var(--t);
}
textarea:focus, input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224,123,84,0.12);
  background: var(--surface);
}
textarea { min-height: 160px; }
select { cursor: pointer; appearance: auto; }

/* ── 結果エリア ── */
.result-wrap { position: relative; }
.result-area {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface2);
  color: var(--text);
  min-height: 160px;
  word-break: break-all;
  white-space: pre-wrap;
  line-height: 1.6;
  transition: border-color var(--t);
}
.result-area.is-error { color: var(--error); border-color: #f5c6c0; background: #fdf5f4; }
.result-area.is-ok    { border-color: #a8d8b8; background: #f2faf5; }

/* コピーボタン */
.copy-btn {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 12px;
  font-family: var(--font);
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s, transform 0.2s, background var(--t), color var(--t);
  pointer-events: none;
}
.copy-btn.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.copy-btn:hover { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.copy-btn.copied { color: var(--success); border-color: #a8d8b8; background: #f2faf5; }

/* ── ボタン ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 13px; font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--t);
  white-space: nowrap;
  line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn-primary   { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn-secondary { background: var(--surface); color: var(--text2); border-color: var(--border); }
.btn-secondary:hover { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text2); }
.btn-ghost:hover { background: var(--accent-bg); color: var(--accent); }

.btn-group {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}

/* ── チップ ── */
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12px; font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--t);
  background: var(--surface);
  user-select: none;
}
.chip.active, .chip:has(input:checked) {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}
.chip input { display: none; }

/* ── 統計バッジ ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.stat-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px; text-align: center; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--accent); line-height: 1; }
.stat-label { font-size: 11px; color: var(--text3); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── 正規表現プレビュー ── */
.regex-preview {
  font-family: var(--mono); font-size: 13px; line-height: 1.9;
  padding: 10px 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r-sm); min-height: 80px;
  word-break: break-all; white-space: pre-wrap;
}
.regex-preview mark { background: #fef08a; color: var(--text); border-radius: 3px; padding: 0 2px; }

/* ── カラーツール ── */
.color-big { width: 100%; height: 80px; border-radius: var(--r-sm); border: 1px solid var(--border); margin-bottom: 12px; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type="color"] { width: 44px; height: 44px; padding: 2px; border-radius: var(--r-sm); cursor: pointer; }

/* ── QRコード ── */
.qr-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 200px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

/* ── infoカード ── */
.info-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px 20px;
  font-size: 13.5px; color: var(--text2); line-height: 1.8;
  margin-bottom: 14px;
}
.info-card h2 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 6px; }

/* ── 広告レクタングル ── */
.ad-rect {
  background: var(--ad-bg); border: 1px solid var(--border);
  border-radius: var(--r);
  min-height: 100px; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 14px;
}

/* ── アフィリエイト ── */
.affiliate-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px 20px; margin-bottom: 14px;
}
.affiliate-box h3 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text3); margin-bottom: 10px; }
.affiliate-box ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.affiliate-box ul li a { font-size: 13px; color: var(--text2); }
.affiliate-box ul li a::before { content: '📖 '; }

/* ── フッター ── */
.site-footer {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 16px 24px; text-align: center;
  font-size: 12px; color: var(--text3);
}
.site-footer a { color: var(--text3); margin: 0 8px; }
.site-footer a:hover { color: var(--accent); text-decoration: none; }

/* ── トップページ ── */
.hero { padding: 32px 0 24px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.hero h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.hero p  { font-size: 13.5px; color: var(--text2); }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tool-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--t), transform var(--t), border-color var(--t);
  display: block; color: var(--text);
}
.tool-item:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--accent); text-decoration: none; }
.tool-item-icon { width: 36px; height: 36px; background: var(--accent-bg); border: 1px solid var(--border); border-radius: 10px; display: grid; place-items: center; font-size: 18px; margin-bottom: 10px; }
.tool-item-name { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.tool-item-desc { font-size: 12px; color: var(--text3); line-height: 1.5; }

/* ── ツールカード（トップページ） ── */
.tool-card-link {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}
.tool-card-link:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--accent);
  text-decoration: none;
}
.tc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.tc-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.tc-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.tc-desc {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.5;
  padding-left: 2px;
}

/* ── レスポンシブ ── */
@media (max-width: 640px) {
  .site-header { padding: 0 14px; }
  .page-wrapper { padding: 18px 14px 40px; }
  .tool-title { font-size: 19px; }
  .tool-split { grid-template-columns: 1fr; }
  .tool-pane + .tool-pane { border-left: none; border-top: 1px solid var(--border); }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 21px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 360px) { .tools-grid { grid-template-columns: 1fr; } }
