/* =========================================================
   モノクロ漫画メーカー  style.css
   - 白背景ベース / 黒・グレー中心 / アクセントは落ち着いた青
   - 角丸カード / 控えめな影 / スマホ余白確保
   ========================================================= */

/* ---- カラー等の変数 ---- */
:root {
  --bg: #f5f6f8;
  --card-bg: #ffffff;
  --ink: #1a1d22;          /* 基本文字色（黒に近いグレー） */
  --ink-sub: #5b6470;      /* サブ文字色 */
  --line: #e2e5ea;         /* 区切り線 */
  --accent: #2f5d8a;       /* 落ち着いた青 */
  --accent-dark: #244a6e;
  --danger: #c0392b;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(20, 30, 50, 0.06);
  --maxw: 1000px;
}

/* ---- リセット ---- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans",
               "Yu Gothic", "Meiryo", sans-serif;
  line-height: 1.7;
  /* 横スクロール防止 */
  overflow-x: hidden;
}

img, canvas { max-width: 100%; }

/* ---- 共通コンテナ：左右の余白を確保 ---- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}

/* =========================================================
   ヘッダー
   ========================================================= */
.site-header {
  background: var(--ink);
  color: #fff;
  padding: 18px 0 24px;
  border-bottom: 4px solid var(--accent);
}
.back-link {
  display: inline-block;
  color: #cfe0f1;
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.back-link:hover { text-decoration: underline; }
.site-title {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: 0.04em;
}
.site-subtitle {
  margin: 6px 0 0;
  color: #c2c8d2;
  font-size: 0.95rem;
}

/* =========================================================
   カード共通
   ========================================================= */
main.container { padding-top: 20px; padding-bottom: 40px; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.card-title {
  margin: 0 0 12px;
  font-size: 1.15rem;
  border-left: 5px solid var(--accent);
  padding-left: 10px;
}
.seo-section .card-title { margin-top: 18px; }
.seo-section .card-title:first-child { margin-top: 0; }

.info-list {
  margin: 0;
  padding-left: 1.3em;
}
.info-list li { margin-bottom: 6px; }

.info-card .privacy-note {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: #eef4fa;
  border: 1px solid #d3e2f0;
  border-radius: 10px;
  color: var(--accent-dark);
  font-size: 0.92rem;
}

/* =========================================================
   メッセージ表示
   ========================================================= */
.message {
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 0.95rem;
}
.message.error {
  background: #fcebe9;
  border: 1px solid #f0c4bd;
  color: var(--danger);
}
.message.success {
  background: #e9f6ee;
  border: 1px solid #c2e6cf;
  color: #1e7a45;
}

/* =========================================================
   画像選択エリア（ドロップゾーン）
   ========================================================= */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 150px;
  padding: 24px 16px;
  text-align: center;
  border: 2px dashed #b9c2cf;
  border-radius: 12px;
  background: #fafbfc;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  background: #f1f6fb;
  outline: none;
}
.dropzone.dragover {
  border-color: var(--accent);
  background: #e7f0f9;
}
.dropzone-icon { font-size: 2.2rem; }
.dropzone-text { font-weight: 600; font-size: 1rem; }
.dropzone-sub { color: var(--ink-sub); font-size: 0.85rem; }

/* 視覚的に隠す（input/file用） */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================
   プレビュー
   ========================================================= */
.preview-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.preview-box { min-width: 0; }
.preview-label {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--ink-sub);
}
.preview-inner {
  position: relative;
  background: #f0f1f4;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px;
}
.preview-canvas {
  display: none;          /* 画像読み込み後にJSで表示 */
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.placeholder {
  color: #9aa3af;
  font-size: 0.9rem;
  margin: 0;
}

/* 変換中オーバーレイ */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
  color: var(--ink);
}
/* hidden属性が付いたときは確実に非表示にする（display:flexより優先させる） */
.loading-overlay[hidden] {
  display: none;
}
.spinner {
  width: 20px; height: 20px;
  border: 3px solid #c7ced8;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   ボタン類
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;            /* スマホで押しやすい高さ */
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #f2f4f7; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid #aac6e3; outline-offset: 2px; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-accent {
  background: #1e7a45;
  border-color: #1e7a45;
  color: #fff;
}
.btn-accent:hover { background: #176236; }

/* 無効状態 */
.btn.disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

/* プリセット */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

/* 操作ボタン行 */
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.action-row .btn { flex: 1 1 140px; }

/* =========================================================
   スライダー
   ========================================================= */
.slider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px 20px;
}
.slider-row label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.slider-val {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: #eef4fa;
  border-radius: 6px;
  padding: 1px 8px;
  font-size: 0.85rem;
}
/* 操作しやすいスライダー */
input[type="range"] {
  width: 100%;
  height: 32px;             /* タップ領域を広く */
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 4px;
  background: #d7dce3;
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 4px;
  background: #d7dce3;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -9px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb {
  outline: 3px solid #aac6e3; outline-offset: 2px;
}

/* =========================================================
   SEOセクション
   ========================================================= */
.seo-section p { margin: 0 0 14px; color: var(--ink-sub); }

/* =========================================================
   フッター
   ========================================================= */
.site-footer {
  background: var(--ink);
  color: #c2c8d2;
  padding: 18px 0;
  font-size: 0.85rem;
  text-align: center;
}
.site-footer p { margin: 0; }

/* =========================================================
   レスポンシブ：スマホでは縦並び
   ========================================================= */
@media (max-width: 600px) {
  .container { padding: 0 14px; }
  .site-title { font-size: 1.5rem; }
  .card { padding: 16px; }
  /* プレビューを縦並びに */
  .preview-wrap { grid-template-columns: 1fr; }
  .action-row .btn { flex: 1 1 100%; }
}
