﻿/* ─── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }
.hidden-input { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: #fff7ed;
  color: #1c1917;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Header ─────────────────────────────────────── */
header {
  background: #ea580c;
  color: #fff;
  padding: 0 1rem;
  height: 52px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(234,88,12,.35);
}
.header-inner { max-width: 1100px; width: 100%; margin: 0 auto; }
.logo { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }

/* ─── Main ───────────────────────────────────────── */
main { max-width: 1100px; width: 100%; margin: 0 auto; padding: 1.5rem 1rem 3rem; flex: 1; }

/* ─── Hero ───────────────────────────────────────── */
.hero { text-align: center; margin-bottom: 1.25rem; }
.hero-icon { font-size: 3rem; margin-bottom: .5rem; }
.hero h1 { font-size: 1.75rem; font-weight: 800; color: #ea580c; margin-bottom: .5rem; }
.description { color: #57534e; font-size: .95rem; line-height: 1.7; }

/* ─── Input Section ──────────────────────────────── */
.input-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: .75rem;
}

.input-pane {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1.5px solid #fed7aa;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(234,88,12,.07);
}

.pane-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .85rem;
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
  gap: .5rem;
  flex-wrap: wrap;
}
.pane-side-label {
  font-size: .82rem;
  font-weight: 700;
  color: #ea580c;
  letter-spacing: .02em;
}
.pane-btns { display: flex; gap: .4rem; }

.pane-btn {
  padding: .28rem .65rem;
  border: 1.5px solid #e7e5e4;
  border-radius: 6px;
  background: #fff;
  color: #57534e;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.pane-btn:hover { border-color: #ea580c; color: #ea580c; }

.pane-filename {
  font-size: .75rem;
  color: #78716c;
  padding: .25rem .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid #f5f5f4;
  background: #fafaf9;
  min-height: 0;
  display: none;
}
.pane-filename.visible { display: block; }

.pane-textarea {
  width: 100%;
  height: 260px;
  min-height: 140px;
  resize: vertical;
  border: none;
  outline: none;
  padding: .75rem 1rem;
  font-family: 'SFMono-Regular', 'Consolas', 'Menlo', 'Monaco', monospace;
  font-size: .84rem;
  line-height: 1.65;
  color: #1c1917;
  background: #fff;
  tab-size: 2;
}
.pane-textarea::placeholder { color: #c4b5a5; }

.pane-footer {
  padding: .3rem .85rem;
  background: #fafaf9;
  border-top: 1px solid #f5f5f4;
  font-size: .74rem;
  color: #a8a29e;
  text-align: right;
}

/* ─── Options Bar ────────────────────────────────── */
.options-bar {
  display: flex;
  align-items: center;
  gap: .75rem 1.25rem;
  flex-wrap: wrap;
  padding: .6rem 1rem;
  background: #fff;
  border: 1.5px solid #e7e5e4;
  border-radius: 12px;
  margin-bottom: 1rem;
}

.opt-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .875rem;
  color: #57534e;
  cursor: pointer;
  user-select: none;
}
.opt-label input[type="checkbox"] {
  accent-color: #ea580c;
  width: 15px;
  height: 15px;
  cursor: pointer;
  flex-shrink: 0;
}

.opt-spacer { flex: 1; min-width: 1rem; }

.btn-compare {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1.4rem;
  background: #ea580c;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s, transform .1s;
  white-space: nowrap;
}
.btn-compare:hover  { background: #c2410c; }
.btn-compare:active { transform: scale(.97); }

.kbd-hint {
  font-size: .68rem;
  font-weight: 400;
  opacity: .75;
  padding: .1rem .35rem;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 4px;
  font-family: inherit;
}

/* ─── Diff Section ───────────────────────────────── */
.diff-section {
  background: #fff;
  border: 1.5px solid #e7e5e4;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.diff-stats-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .85rem;
  background: #f5f5f4;
  border-bottom: 1px solid #e7e5e4;
  min-height: 38px;
  flex-wrap: wrap;
}
.diff-stats { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; flex: 1; }

.stat-changed { font-size: .8rem; font-weight: 700; color: #b45309; background: #fef3c7; padding: .18rem .55rem; border-radius: 999px; }
.stat-added   { font-size: .8rem; font-weight: 700; color: #15803d; background: #dcfce7; padding: .18rem .55rem; border-radius: 999px; }
.stat-removed { font-size: .8rem; font-weight: 700; color: #b91c1c; background: #fee2e2; padding: .18rem .55rem; border-radius: 999px; }
.stat-same    { font-size: .8rem; font-weight: 600; color: #78716c; background: #f5f5f4; padding: .18rem .55rem; border-radius: 999px; }

.btn-expand-all {
  font-size: .78rem;
  font-weight: 600;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: .2rem .6rem;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.btn-expand-all:hover { background: #bae6fd; }

/* ─── Diff Area ──────────────────────────────────── */
.diff-area {
  overflow-x: auto;
  /* grows naturally */
}

.diff-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: 2.5rem 1rem;
  color: #a8a29e;
  font-size: .9rem;
}
.ph-icon { font-size: 2rem; }

.diff-identical {
  padding: 2rem;
  text-align: center;
  color: #15803d;
  font-weight: 700;
  font-size: .95rem;
}

/* ─── Diff Rows ──────────────────────────────────── */
.diff-row {
  display: flex;
  align-items: stretch;
  font-family: 'SFMono-Regular', 'Consolas', 'Menlo', 'Monaco', monospace;
  font-size: .82rem;
  line-height: 1.65;
  border-bottom: 1px solid transparent;
  min-width: 0;
}

.diff-same    { background: #fafaf9; }
.diff-removed { background: #fff5f5; border-bottom-color: #fee2e2; }
.diff-added   { background: #f0fdf4; border-bottom-color: #dcfce7; }

/* Left border accent */
.diff-removed { border-left: 3px solid #fca5a5; }
.diff-added   { border-left: 3px solid #86efac; }
.diff-same    { border-left: 3px solid transparent; }

/* Line numbers */
.ln {
  min-width: 44px;
  padding: 0 8px;
  text-align: right;
  color: #d6d3d1;
  user-select: none;
  flex-shrink: 0;
  border-right: 1px solid #f0efed;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.diff-removed .ln { color: #fca5a5; border-right-color: #fecaca; }
.diff-added   .ln { color: #86efac; border-right-color: #bbf7d0; }

.diff-marker {
  width: 18px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-weight: 700;
  color: #d6d3d1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.diff-removed .diff-marker { color: #f87171; }
.diff-added   .diff-marker { color: #4ade80; }

.diff-code {
  flex: 1;
  padding: 0 .85rem;
  white-space: pre-wrap;
  word-break: break-all;
  min-width: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: #44403c;
}
.diff-removed .diff-code { color: #b91c1c; }
.diff-added   .diff-code { color: #15803d; }

/* ─── Word-level diff marks ──────────────────────── */
mark.wd-del {
  background: #fca5a5;
  color: #7f1d1d;
  border-radius: 2px;
  padding: 0 2px;
  font-style: normal;
}
mark.wd-add {
  background: #86efac;
  color: #14532d;
  border-radius: 2px;
  padding: 0 2px;
  font-style: normal;
}

/* ─── Context Collapse ───────────────────────────── */
.diff-collapse {
  display: flex;
  align-items: center;
  gap: .5rem;
  /* indent same as diff-code: 44+44+18px of fixed cols + padding */
  padding: .3rem .75rem .3rem 1rem;
  background: #f0f9ff;
  border-top: 1px solid #bae6fd;
  border-bottom: 1px solid #bae6fd;
  border-left: 3px solid #7dd3fc;
  cursor: pointer;
  font-size: .78rem;
  color: #0369a1;
  font-weight: 600;
  user-select: none;
  transition: background .15s;
  font-family: 'SFMono-Regular', 'Consolas', 'Menlo', monospace;
}
.diff-collapse:hover { background: #e0f2fe; }
.collapse-caret { font-size: .8rem; transition: transform .15s; }

.collapse-body { display: none; }
.collapse-body.open { display: block; }

/* ─── Info Card ──────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 14px;
  border: 1.5px solid #fed7aa;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(234,88,12,.07);
}
.card h2 { font-size: 1.1rem; font-weight: 700; color: #ea580c; margin-bottom: .75rem; }
.tips-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.tip-item  { display: flex; gap: .75rem; }
.tip-icon  { font-size: 1.5rem; flex-shrink: 0; }
.tip-text strong { display: block; font-weight: 700; margin-bottom: .2rem; font-size: .9rem; }
.tip-text p { font-size: .82rem; color: #78716c; line-height: 1.5; }

/* ─── Footer ─────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: .82rem;
  color: #a8a29e;
  border-top: 1px solid #e7e5e4;
  margin-top: auto;
}
footer a { color: #ea580c; text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer p + p { margin-top: .3rem; }

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 720px) {
  .input-section { grid-template-columns: 1fr; }
  .pane-textarea  { height: 200px; }
  .tips-grid      { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .btn-compare .kbd-hint { display: none; }
  .opt-spacer { display: none; }
}

/* ━━━ Amazonおすすめ ━━━ */
.amazon-card h2 { margin-bottom: 0.25rem; }
.amazon-note { font-size: 0.82rem; color: #999; margin-bottom: 1rem; }
.amazon-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.amazon-item {
  display: block;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 0.9rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}
.amazon-item:hover {
  border-color: #FF9900;
  box-shadow: 0 2px 8px rgba(255,153,0,0.15);
  transform: translateY(-1px);
}
.amazon-item-icon { font-size: 1.7rem; margin-bottom: 0.35rem; }
.amazon-item-name { font-size: 0.88rem; font-weight: bold; margin-bottom: 0.2rem; }
.amazon-item-desc { font-size: 0.76rem; color: #888; line-height: 1.5; margin-bottom: 0.45rem; }
.amazon-item-link { font-size: 0.78rem; color: #FF9900; font-weight: bold; }

.amazon-notice {
  font-size: 0.72rem;
  color: #bbb;
  margin-top: 0.2rem;
}

/* ━━━ FAQ ━━━ */
.faq-list { display: flex; flex-direction: column; }
.faq-item { padding: .9rem 0; border-bottom: 1px solid #f0f0f0; }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-q { font-size: .9rem; font-weight: 700; color: #ea580c; margin-bottom: .35rem; }
.faq-a { font-size: .85rem; color: #555; line-height: 1.75; }

/* ━━━ カードの間隔 ━━━ */
.card { margin-bottom: 1.25rem; }

/* ━━━ ヒーローバッジ ━━━ */
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.badge {
  display: inline-block;
  padding: 5px 13px;
  background: #fff7ed;
  color: #ea580c;
  border: 1.5px solid #fed7aa;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ━━━ 差分早見表 ━━━ */
.table-note-top { font-size: 0.83rem; color: #78716c; margin-bottom: 10px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 10px; }
.diff-ref-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; min-width: 440px; }
.diff-ref-table th {
  background: #ea580c;
  color: #fff;
  font-weight: 700;
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
}
.diff-ref-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #fef3e2;
  color: #44403c;
  vertical-align: top;
  line-height: 1.55;
}
.diff-ref-table tr:last-child td { border-bottom: none; }
.diff-ref-table .hl-row td { background: #fff7ed; }
.diff-ref-table .section-row td {
  background: #fff7ed;
  font-weight: 700;
  color: #ea580c;
  font-size: 0.82rem;
  padding: 6px 12px;
}
.table-note { font-size: 0.78rem; color: #a8a29e; line-height: 1.6; margin-top: 8px; }

/* ━━━ 活用シーン ━━━ */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
.scene-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  background: #fff7ed;
  border: 1.5px solid #fed7aa;
  border-radius: 12px;
}
.scene-icon { font-size: 1.7rem; flex-shrink: 0; }
.scene-body strong { display: block; font-size: .88rem; font-weight: 700; color: #ea580c; margin-bottom: .2rem; }
.scene-body p { font-size: .78rem; color: #78716c; line-height: 1.55; margin: 0; }

/* ━━━ 関連ツール ━━━ */
.related-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}
.related-tool-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  border: 1.5px solid #fed7aa;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.related-tool-item:hover { border-color: #ea580c; box-shadow: 0 2px 8px rgba(234,88,12,.12); }
.related-tool-icon { font-size: 1.6rem; flex-shrink: 0; }
.related-tool-item strong { display: block; font-size: .88rem; font-weight: 700; color: #ea580c; margin-bottom: .2rem; }
.related-tool-item p { font-size: .76rem; color: #78716c; line-height: 1.5; margin: 0; }

@media (max-width: 600px) {
  .scene-grid { grid-template-columns: 1fr; }
  .related-tools { grid-template-columns: 1fr; }
}
