/* ─────────────────────────────────────────────
   ZINEメーカー v0.1 — スタイルシート
   テーマ：やわらかい紙もの感 / オフホワイト・ベージュ・ミュートブルー
   ───────────────────────────────────────────── */

/* ══════════════════════════════════════════════
   CSS 変数
   ══════════════════════════════════════════════ */
:root {
  /* 背景 */
  --bg:           #ede8e0;
  --bg-panel:     #f8f4ee;
  --bg-card:      #fffefb;
  --bg-hover:     #f2ece4;

  /* テキスト */
  --text:         #352d25;
  --text-sub:     #7a7068;
  --text-muted:   #aaa098;
  --text-on-blue: #ffffff;

  /* アクセント：ミュートブルー */
  --blue:         #6e95b8;
  --blue-hover:   #5a81a4;
  --blue-light:   #d0e4f2;
  --blue-dark:    #4a7090;
  --blue-xlight:  #eaf3fb;

  /* ウォーム */
  --warm:         #c8a882;
  --warm-light:   #f5ede0;
  --warm-dark:    #a88a68;

  /* ステータス */
  --green-light:  #d4edda;
  --green:        #3d7050;
  --danger:       #b84040;
  --danger-light: #fdeaea;
  --warning-bg:   #fef7e8;
  --warning-text: #7a5800;
  --warning-border:#e8c870;

  /* ボーダー・シャドウ */
  --border:       #ddd0c0;
  --border-strong:#c4b4a0;

  --shadow-sm:    0 1px 4px rgba(50,35,20,.07);
  --shadow:       0 3px 14px rgba(50,35,20,.09);
  --shadow-lg:    0 8px 36px rgba(50,35,20,.13);
  --shadow-paper: 3px 4px 16px rgba(50,35,20,.15);

  /* 角丸 */
  --radius-sm:    4px;
  --radius:       8px;
  --radius-lg:    12px;
  --radius-xl:    18px;

  /* フォント */
  --font-sans:    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Noto Sans JP", sans-serif;
  --font-serif:   "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", Georgia, serif;
}

/* ══════════════════════════════════════════════
   リセット & ベース
   ══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

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

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }

/* ══════════════════════════════════════════════
   ヘッダー
   ══════════════════════════════════════════════ */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  flex-wrap: wrap;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 200px;
}

.brand-icon {
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(100,70,30,.15));
}

.brand-text { flex: 1; min-width: 0; }

.brand-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.brand-tagline {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.header-actions-sep {
  display: block;
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 2px;
}

.header-note {
  background: var(--warm-light);
  border-top: 1px solid #e8d8c4;
  padding: 9px 24px;
  font-size: 12px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.note-sep { color: var(--border-strong); }

/* ══════════════════════════════════════════════
   ボタン
   ══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--text-on-blue);
  box-shadow: 0 2px 8px rgba(74,112,144,.3);
}
.btn-primary:hover {
  background: var(--blue-hover);
  border-color: var(--blue-hover);
  box-shadow: 0 3px 12px rgba(74,112,144,.4);
}

.btn-canva {
  background: #e8f5ef;
  border-color: #b8d9c8;
  color: #2d7a56;
}
.btn-canva:hover {
  background: #d4eddf;
  border-color: #8fc4a8;
  box-shadow: 0 2px 8px rgba(45,122,86,.15);
}
.btn-canva:disabled { opacity: .55; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-reset:hover { color: var(--danger); border-color: var(--danger-light); background: var(--danger-light); }

.btn-secondary {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover { background: var(--blue-light); border-color: var(--blue); color: var(--blue-dark); }

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover { opacity: .9; }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }

.w-full { width: 100%; justify-content: center; }

/* ══════════════════════════════════════════════
   3カラムメイン
   ══════════════════════════════════════════════ */
.app-main {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.panel {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
}

.panel-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* デスクトップ: upper-panels は左+中央を並べるだけ（app-main が flex row） */
.upper-panels {
  display: contents; /* flex children に展開 */
}

/* 左パネル：基本設定 */
.panel-settings {
  width: 256px;
  min-width: 220px;
  flex-shrink: 0;
  padding: 18px 16px;
}

/* 中央パネル：ページ構成 */
.panel-pages {
  width: 288px;
  min-width: 240px;
  flex-shrink: 0;
}

/* 右パネル：プレビュー */
.panel-preview {
  flex: 1;
  min-width: 320px;
  border-right: none;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

/* ══════════════════════════════════════════════
   フォーム
   ══════════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.form-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-input::placeholder { color: var(--text-muted); opacity: 1; }
.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-light);
  background: var(--bg-card);
}

.form-input-sm { width: 76px; }
.form-unit { font-size: 12px; color: var(--text-sub); margin-left: 7px; }

.form-textarea { resize: vertical; min-height: 110px; }

.custom-page-row {
  display: flex;
  align-items: center;
  margin-top: 8px;
}

/* ══════════════════════════════════════════════
   チップ（ZINEタイプ・ページ数）
   ══════════════════════════════════════════════ */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  padding: 4px 11px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 500;
  transition: all .15s;
}
.chip:hover { border-color: var(--blue); color: var(--blue-dark); }
.chip.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 1px 4px rgba(74,112,144,.25);
}

.chip-sm {
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-sub);
  font-size: 11.5px;
  transition: all .15s;
}
.chip-sm:hover { border-color: var(--blue); color: var(--blue-dark); background: var(--blue-xlight); }

/* ══════════════════════════════════════════════
   警告ボックス
   ══════════════════════════════════════════════ */
.warning-box {
  margin-top: 8px;
  padding: 9px 11px;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius);
  color: var(--warning-text);
  font-size: 11.5px;
  line-height: 1.6;
}

/* ══════════════════════════════════════════════
   テンプレートカード
   ══════════════════════════════════════════════ */
.template-grid { display: flex; gap: 8px; }

.template-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 10px 6px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  transition: all .18s;
  position: relative;
}
.template-card:hover { border-color: var(--blue); box-shadow: var(--shadow-sm); }
.template-card.active {
  border-color: var(--blue);
  background: var(--blue-xlight);
  box-shadow: 0 0 0 1px var(--blue), var(--shadow-sm);
}
.template-card.active::after {
  content: '✓';
  position: absolute;
  top: 5px;
  right: 7px;
  font-size: 10px;
  color: var(--blue);
  font-weight: 700;
}

/* テンプレートサムネイル */
.template-thumb {
  width: 56px;
  height: 80px;
  border-radius: 3px;
  padding: 6px 7px;
  position: relative;
  overflow: hidden;
}
.copybook-thumb {
  background: #fafaf8;
  border: 1px solid #c8c4be;
  background-image: repeating-linear-gradient(
    0deg, transparent, transparent 10px,
    rgba(0,0,0,.04) 10px, rgba(0,0,0,.04) 11px
  );
}
.minimal-thumb { background: #ffffff; border: 1px solid #e4e0da; }
.photo-thumb   { background: #1e1e28; border: 1px solid #444; }

.tt-rule        { height: 1px; background: #b0a898; margin-bottom: 5px; }
.tt-title       { height: 7px; background: #555; border-radius: 2px; width: 72%; margin-bottom: 5px; }
.tt-body        { height: 3px; background: #c0bab5; border-radius: 2px; margin-bottom: 3px; }
.tt-body.short  { width: 55%; }
.tt-center-title{ height: 6px; background: #2a2a2a; border-radius: 2px; width: 62%; margin: 0 auto 8px; }
.tt-space       { height: 16px; }
.tt-photo-block { height: 44px; background: #444; border-radius: 2px; margin-bottom: 5px; }
.tt-caption     { height: 3px; background: #888; border-radius: 2px; width: 55%; }

.template-label {
  font-size: 10.5px;
  color: var(--text-sub);
  text-align: center;
  font-weight: 500;
}
.template-card.active .template-label { color: var(--blue-dark); }

/* ══════════════════════════════════════════════
   ページ構成パネル
   ══════════════════════════════════════════════ */
.pages-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.page-total-badge {
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-weight: 600;
}

.pages-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.pages-panel-footer {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  background: var(--bg-panel);
}

.quick-add-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.quick-add-label { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ── ページリストアイテム ── */
.page-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 7px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--bg-card);
  margin-bottom: 4px;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.page-item:hover { border-color: var(--border); box-shadow: var(--shadow-sm); }
.page-item.drag-over { border-color: var(--blue); background: var(--blue-xlight); }
.page-item.dragging { opacity: .4; }
.page-item.is-active {
  background: var(--blue-xlight);
  border-color: var(--blue-light);
  box-shadow: inset 3px 0 0 var(--blue);
}
.page-item.is-active:hover {
  border-color: var(--blue-light);
  box-shadow: inset 3px 0 0 var(--blue), var(--shadow-sm);
}
.page-item.is-active .page-item-num {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.page-item-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-sub);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.page-item-info { flex: 1; min-width: 0; }

.page-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.page-item-type { font-size: 10.5px; color: var(--text-muted); }

.page-item-actions { display: flex; gap: 2px; flex-shrink: 0; }

.page-action-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sub);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  padding: 0;
}
.page-action-btn:hover { background: var(--bg); border-color: var(--border); color: var(--text); }
.page-action-btn.delete-btn:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger-light); }
.page-action-btn:disabled { opacity: .25; cursor: not-allowed; }

/* ══════════════════════════════════════════════
   プレビューパネル
   ══════════════════════════════════════════════ */
.preview-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preview-mode-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.tab {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 500;
  transition: all .15s;
}
.tab:hover { background: var(--bg-hover); }
.tab.active { background: var(--blue); color: #fff; }

/* プレビューの台紙エリア */
.preview-viewport {
  flex: 1;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #e8e0d4 0%, #d8d0c8 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  padding: 16px 20px;
  overflow: auto;
}

/* ── ページプレビューカード ── */
.preview-page {
  position: relative;
  background: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

/* A5比率 148:210 = 1:1.419 */
.preview-page.size-single {
  width: 360px;
  height: 511px;
  border-radius: 3px 4px 4px 3px;
  box-shadow: var(--shadow-paper);
}

.preview-page.size-spread {
  width: 255px;
  height: 362px;
  box-shadow: none;
}

/* 見開きゴーストページ（表紙・裏表紙の反対ページ） */
.preview-page.ghost-page {
  background: rgba(255, 255, 255, 0.28);
  border: 1px dashed rgba(210, 195, 175, 0.45);
  pointer-events: none;
}

.preview-page.size-print {
  width: 100%;
  padding-top: 141.9%;
  border-radius: 2px;
  box-shadow: 2px 3px 10px rgba(50,35,20,.18);
}

.preview-page.size-print .page-inner {
  position: absolute;
  inset: 0;
}

.page-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* サイズ別パディング */
.preview-page.size-single .page-inner { padding: 24px; }
.preview-page.size-spread .page-inner { padding: 14px; }

/* ページ番号バッジ */
.page-num-badge {
  position: absolute;
  bottom: 7px;
  right: 8px;
  font-size: 9px;
  color: var(--text-muted);
  z-index: 5;
  line-height: 1;
}

/* ── 見開きコンテナ ── */
.spread-container {
  display: flex;
  gap: 0;
  align-items: flex-start;
  justify-content: center;
  filter: drop-shadow(0 6px 24px rgba(50,35,20,.2));
}

/* 2ページ見開き時の背表紙効果 */
.spread-container.two-page-spread .preview-page:first-child {
  border-right: none;
  border-radius: 3px 0 0 3px;
  box-shadow: inset -6px 0 12px rgba(0,0,0,.08);
}
.spread-container.two-page-spread .preview-page:last-child {
  border-radius: 0 4px 4px 0;
  box-shadow: inset 6px 0 12px rgba(0,0,0,.04);
}
.spread-container.two-page-spread::after {
  content: '';
  position: absolute;
  /* binding は CSS filter で処理 */
}

/* 単ページ（表紙・裏表紙など）の見開き表示 */
.spread-container:not(.two-page-spread) .preview-page {
  box-shadow: var(--shadow-paper);
  border-radius: 3px 4px 4px 3px;
}

/* 印刷順グリッド */
.print-order-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  width: 100%;
}

.print-page-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.print-page-label {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════
   テンプレートスタイル（プレビュー内ページ）
   ══════════════════════════════════════════════ */

/* ─── コピー本風 ─── */
.t-copybook {
  font-family: var(--font-serif);
  background: #fafaf7;
  color: #252020;
  background-image: repeating-linear-gradient(
    0deg, transparent, transparent 18px,
    rgba(0,0,0,.035) 18px, rgba(0,0,0,.035) 19px
  );
}

.t-copybook .page-inner {
  padding: 18px 16px;
}
.preview-page.size-single.t-copybook .page-inner {
  padding: 28px 24px;
}

/* 表紙 */
.t-copybook.cover-page .page-inner {
  background: #fafaf7;
  background-image: none;
  border: 8px solid #3a3530;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
}
.t-copybook .cover-title {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 2px;
  color: #1e1a18;
}
.preview-page.size-single .cover-title { font-size: 18px; margin-bottom: 4px; }
.t-copybook .cover-subtitle { font-size: 8px; color: #706860; margin-bottom: 6px; }
.preview-page.size-single .cover-subtitle { font-size: 11px; }
.preview-page.size-single .cover-subtitle-empty { color: #bbb; font-style: italic; }
.t-copybook .cover-image { width: 100%; margin: 6px 0; }
.t-copybook .cover-image img { width: 100%; max-height: 90px; object-fit: cover; }
.preview-page.size-single .cover-image img { max-height: 158px; }
.t-copybook .cover-author { font-size: 7.5px; color: #a09898; margin-top: 4px; }
.preview-page.size-single .cover-author { font-size: 11px; }
.preview-page.size-single .cover-author-empty { color: #ccc; font-style: italic; }
.t-copybook .cover-year { font-size: 7px; color: #bbb; margin-top: 2px; }

/* 表紙プレースホルダー */
.cover-img-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed currentColor;
  border-radius: 3px;
  gap: 5px;
  margin: 6px 0;
  opacity: .5;
  cursor: pointer;
  transition: opacity .15s;
  font-size: 8px;
  color: #888;
}
.cover-img-placeholder:hover { opacity: .75; }
.cover-img-placeholder .ph-icon { font-size: 20px; }

/* 裏表紙 */
.t-copybook .backcover-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.t-copybook .backcover-zinename {
  font-size: 7.5px;
  color: #c0b8b0;
  border-top: 1px solid #ddd;
  padding-top: 5px;
  margin-top: 8px;
  width: 100%;
  text-align: center;
}

/* ページタイトル（コピー本風） */
.t-copybook .pg-title {
  font-size: 8.5px;
  font-weight: 700;
  border-bottom: 1.5px solid #a09890;
  padding-bottom: 4px;
  margin-bottom: 7px;
  color: #252020;
}
.preview-page.size-single .t-copybook .pg-title { font-size: 13px; }

.t-copybook .pg-body {
  font-size: 7.5px;
  line-height: 1.9;
  color: #3a3530;
  flex: 1;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-all;
}
.preview-page.size-single .t-copybook .pg-body { font-size: 10.5px; }

.t-copybook .pg-caption {
  font-size: 7px;
  color: #a09898;
  margin-top: 5px;
  font-style: italic;
}

.t-copybook .pg-image { margin-bottom: 7px; flex-shrink: 0; }
.t-copybook .pg-image img { width: 100%; max-height: 80px; object-fit: cover; border-radius: 2px; }
.preview-page.size-single .t-copybook .pg-image img { max-height: 140px; }

/* ─── ミニマル文芸風 ─── */
.t-minimal {
  font-family: var(--font-sans);
  background: #ffffff;
  color: #1a1a1a;
}
.t-minimal .page-inner { padding: 20px 18px; }
.preview-page.size-single.t-minimal .page-inner { padding: 40px 34px; }

.t-minimal.cover-page .page-inner {
  align-items: center;
  justify-content: center;
  text-align: center;
}
.t-minimal .cover-title {
  font-size: 13px;
  font-weight: 200;
  letter-spacing: 0.18em;
  margin-bottom: 8px;
  line-height: 1.5;
  color: #111;
}
.preview-page.size-single .t-minimal .cover-title { font-size: 22px; letter-spacing: 0.2em; }
.t-minimal .cover-subtitle {
  font-size: 7.5px;
  color: #aaa;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.preview-page.size-single .t-minimal .cover-subtitle { font-size: 11px; }
.preview-page.size-single .t-minimal .cover-subtitle-empty { color: #ccc; font-style: normal; }
.t-minimal .cover-image { margin: 10px 0; width: 100%; }
.t-minimal .cover-image img { width: 100%; max-height: 80px; object-fit: cover; }
.preview-page.size-single .t-minimal .cover-image img { max-height: 148px; }
.t-minimal .cover-author { font-size: 7px; color: #ccc; letter-spacing: 0.15em; margin-top: 10px; }
.preview-page.size-single .t-minimal .cover-author { font-size: 10px; }
.preview-page.size-single .t-minimal .cover-author-empty { color: #ddd; font-style: normal; }
.t-minimal .cover-year { font-size: 6.5px; color: #ddd; margin-top: 3px; }
.t-minimal .cover-rule {
  width: 30px;
  height: 1px;
  background: #ccc;
  margin: 8px auto;
}

.t-minimal .pg-title {
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: #222;
  margin-bottom: 12px;
  text-align: center;
}
.preview-page.size-single .t-minimal .pg-title { font-size: 13px; }

.t-minimal .pg-body {
  font-size: 7.5px;
  line-height: 2;
  color: #444;
  flex: 1;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-all;
}
.preview-page.size-single .t-minimal .pg-body { font-size: 10.5px; }

.t-minimal .pg-caption { font-size: 7px; color: #bbb; text-align: center; margin-top: 8px; }
.t-minimal .pg-image { margin: 6px 0; }
.t-minimal .pg-image img { width: 100%; max-height: 80px; object-fit: cover; }
.preview-page.size-single .t-minimal .pg-image img { max-height: 140px; }

.t-minimal .backcover-zinename {
  font-size: 7px;
  color: #ccc;
  text-align: center;
  margin-top: auto;
  padding-top: 8px;
  letter-spacing: 0.12em;
}

/* ─── 写真ZINE風 ─── */
.t-photo {
  font-family: var(--font-sans);
  background: #181820;
  color: #f0f0f0;
}
.t-photo .page-inner { padding: 10px; }
.preview-page.size-single.t-photo .page-inner { padding: 18px; }

.t-photo.cover-page .page-inner {
  padding: 0;
  position: relative;
  justify-content: flex-end;
}
.t-photo .cover-bg-image {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.t-photo .cover-bg-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .65;
}
.t-photo .cover-text {
  position: relative;
  z-index: 1;
  padding: 12px;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, transparent 100%);
  width: 100%;
}
.t-photo .cover-title {
  font-size: 11px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
  line-height: 1.25;
  letter-spacing: 0.02em;
}
.preview-page.size-single .t-photo .cover-title { font-size: 20px; }
.t-photo .cover-subtitle { font-size: 7px; color: rgba(255,255,255,.7); margin-top: 3px; }
.preview-page.size-single .t-photo .cover-subtitle { font-size: 10px; }
.t-photo .cover-author { font-size: 6.5px; color: rgba(255,255,255,.5); margin-top: 2px; }
.preview-page.size-single .t-photo .cover-author { font-size: 9px; }

.t-photo .cover-placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #2a2a3a, #3a3848);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 24px;
}

.t-photo .pg-title {
  font-size: 7.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #d0d0d0;
  margin-bottom: 5px;
}
.preview-page.size-single .t-photo .pg-title { font-size: 11px; }

.t-photo .pg-image {
  flex: 1;
  margin-bottom: 5px;
  overflow: hidden;
  border-radius: 2px;
  min-height: 40px;
}
.t-photo .pg-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.t-photo .pg-image.placeholder {
  background: linear-gradient(135deg, #2a2a38 0%, #353548 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #444;
  font-size: 20px;
}

.t-photo .pg-body { font-size: 7px; color: #b0b0c0; line-height: 1.7; overflow: hidden; white-space: pre-wrap; word-break: break-all; }
.preview-page.size-single .t-photo .pg-body { font-size: 10px; }
.t-photo .pg-caption { font-size: 6.5px; color: #666; margin-top: 3px; font-style: italic; }
.t-photo .backcover-zinename { font-size: 7px; color: #444; text-align: center; margin-top: auto; padding-top: 8px; }

/* 空ページヒント */
.empty-page-hint {
  color: var(--text-muted);
  font-size: 7.5px;
  text-align: center;
  margin: auto;
  padding: 8px;
  opacity: .55;
  font-family: var(--font-sans);
}
.t-photo .empty-page-hint { color: #555; }

/* ══════════════════════════════════════════════
   プレビューナビ & ヒント
   ══════════════════════════════════════════════ */
.preview-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.preview-nav-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  box-shadow: var(--shadow-sm);
}
.preview-nav-btn:hover { background: var(--blue-light); border-color: var(--blue); color: var(--blue-dark); }
.preview-nav-btn:disabled { opacity: .28; cursor: not-allowed; box-shadow: none; }

.preview-page-info {
  font-size: 13px;
  color: var(--text-sub);
  min-width: 130px;
  text-align: center;
  font-weight: 500;
}

.preview-hint {
  font-size: 11.5px;
  color: var(--text-sub);
  text-align: center;
  padding: 7px 14px;
  background: var(--warm-light);
  border-radius: var(--radius);
  border: 1px solid #e4d4c0;
  line-height: 1.6;
}

.export-guide {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-sub);
  padding: 7px 14px;
  background: var(--warm-light);
  border-radius: var(--radius);
  border: 1px solid #e4d4c0;
  line-height: 1.6;
}

.export-guide-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.eg-label {
  font-family: ui-monospace, SFMono-Regular, "Courier New", monospace;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  letter-spacing: 0;
}

.eg-canva {
  color: #2d7a56;
  background: #e8f5ef;
  border-color: #b8d9c8;
}

.export-guide-sep {
  color: var(--border-strong);
  font-size: 13px;
}

/* ══════════════════════════════════════════════
   ヘルプセクション（フッター）
   ══════════════════════════════════════════════ */
.help-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 20px 24px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.help-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.help-card-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hc-icon { font-size: 15px; }

.help-card-body {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.7;
}
.help-card-body-mt { margin-top: 8px; }

.help-list {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.8;
}
ul.help-list { list-style: none; }
ul.help-list li { padding-left: 10px; position: relative; }
ul.help-list li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}
ol.help-list { padding-left: 16px; }
ol.help-list li { padding-left: 4px; }

.check-list {
  list-style: none;
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.8;
}
.check-list li { padding-left: 18px; position: relative; }
.check-list li::before {
  content: '□';
  position: absolute;
  left: 0;
  color: var(--warm);
  font-size: 11px;
}

.help-tip {
  font-size: 11px;
  color: var(--green);
  margin-top: 8px;
  padding: 6px 9px;
  background: var(--green-light);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--green);
}

.help-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.6;
}

/* PDFと.zineの視覚的比較 */
.file-compare {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
}
.file-type-box {
  flex: 1;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 6px;
  text-align: center;
}
.file-type-zine {
  background: var(--blue-xlight);
  border-color: var(--blue-light);
}
.file-type-pptx {
  background: #e8f5ef;
  border-color: #b8d9c8;
}
.file-type-icon { font-size: 18px; margin-bottom: 3px; }
.file-type-name { font-size: 12px; font-weight: 700; color: var(--text); display: block; margin-bottom: 3px; }
.file-type-desc { font-size: 10.5px; color: var(--text-sub); line-height: 1.5; }
.file-compare-arrow { font-size: 16px; color: var(--text-muted); flex-shrink: 0; }

/* ══════════════════════════════════════════════
   モーダル
   ══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,10,5,.48);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-sm { max-width: 360px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text); }

.modal-close-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.modal-close-btn:hover { background: var(--bg-hover); color: var(--text); }

.modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }

.modal-desc {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.75;
}
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════
   画像アップロードゾーン
   ══════════════════════════════════════════════ */
.image-drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  transition: all .15s;
  cursor: pointer;
}
.image-drop-zone:hover, .image-drop-zone.drag-active {
  border-color: var(--blue);
  background: var(--blue-xlight);
}

.image-drop-inner {
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.drop-icon { font-size: 28px; opacity: .45; }
.drop-hint { font-size: 12px; color: var(--text-muted); text-align: center; }

.image-size-note { font-size: 11px; color: var(--text-muted); margin-top: 5px; }

.modal-image-preview {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

/* ══════════════════════════════════════════════
   トースト
   ══════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,22,15,.92);
  color: #fff;
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity .2s;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.toast.toast-success { background: rgba(30,80,50,.92); }
.toast.toast-error   { background: rgba(100,20,20,.92); }
.toast.hidden { opacity: 0; }

/* ══════════════════════════════════════════════
   PDF レンダリングエリア（非表示）
   ══════════════════════════════════════════════ */
#pdf-render-area {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 595px;
  height: 842px;
  overflow: hidden;
  background: #fff;
  z-index: -1;
}

/* ══════════════════════════════════════════════
   PDF用ページスタイル（#pdf-render-area 内）
   ══════════════════════════════════════════════ */
.pdf-page {
  width: 595px;
  height: 842px;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  background: #fff;
}

/* コピー本風PDF */
.pdf-page.t-copybook {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
  padding: 52px 48px;
  background: #fafaf8;
  color: #2a2220;
}
.pdf-page.t-copybook .pdf-rule {
  border-top: 1.5px solid #b0a898;
  margin-bottom: 20px;
}
.pdf-page.t-copybook .pdf-pg-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
}
.pdf-page.t-copybook .pdf-pg-body {
  font-size: 12px;
  line-height: 2.1;
  white-space: pre-wrap;
  word-break: break-all;
}
.pdf-page.t-copybook .pdf-pg-caption {
  font-size: 10px;
  color: #888;
  margin-top: 12px;
  font-style: italic;
}
.pdf-page.t-copybook .pdf-pg-image {
  margin: 16px 0;
  text-align: center;
}
.pdf-page.t-copybook .pdf-pg-image img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
}
.pdf-page.t-copybook .pdf-page-num {
  position: absolute;
  bottom: 32px;
  right: 48px;
  font-size: 10px;
  color: #bbb;
}
.pdf-page.t-copybook.pdf-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 48px;
  border: 3px solid #3a3530;
}
.pdf-page.t-copybook .pdf-cover-title {
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.4;
}
.pdf-page.t-copybook .pdf-cover-subtitle {
  font-size: 14px;
  color: #7a7068;
  margin-bottom: 24px;
}
.pdf-page.t-copybook .pdf-cover-image { margin: 24px 0; max-width: 340px; }
.pdf-page.t-copybook .pdf-cover-image img { max-width: 100%; max-height: 260px; object-fit: contain; }
.pdf-page.t-copybook .pdf-cover-author { font-size: 13px; color: #9a928a; margin-top: 14px; }
.pdf-page.t-copybook .pdf-cover-year { font-size: 11px; color: #bbb; margin-top: 4px; }

/* ミニマル文芸風PDF */
.pdf-page.t-minimal {
  font-family: "Hiragino Sans", sans-serif;
  padding: 72px 64px;
  background: #fff;
  color: #1a1a1a;
}
.pdf-page.t-minimal .pdf-pg-title {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-align: center;
  margin-bottom: 36px;
  color: #333;
}
.pdf-page.t-minimal .pdf-pg-body {
  font-size: 11.5px;
  line-height: 2.2;
  white-space: pre-wrap;
  word-break: break-all;
  color: #444;
}
.pdf-page.t-minimal .pdf-pg-caption {
  font-size: 10px;
  color: #aaa;
  text-align: center;
  margin-top: 20px;
}
.pdf-page.t-minimal .pdf-pg-image { margin: 24px 0; text-align: center; }
.pdf-page.t-minimal .pdf-pg-image img { max-width: 100%; max-height: 300px; object-fit: contain; }
.pdf-page.t-minimal .pdf-page-num {
  position: absolute;
  bottom: 40px;
  left: 0; right: 0;
  text-align: center;
  font-size: 10px;
  color: #ccc;
}
.pdf-page.t-minimal.pdf-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.pdf-page.t-minimal .pdf-cover-rule { width: 40px; height: 1px; background: #ccc; margin: 0 auto 20px; }
.pdf-page.t-minimal .pdf-cover-title {
  font-size: 34px;
  font-weight: 200;
  letter-spacing: 0.22em;
  margin-bottom: 16px;
  line-height: 1.5;
}
.pdf-page.t-minimal .pdf-cover-subtitle { font-size: 12px; color: #999; letter-spacing: 0.1em; margin-bottom: 24px; }
.pdf-page.t-minimal .pdf-cover-image { margin: 24px 0; }
.pdf-page.t-minimal .pdf-cover-image img { max-width: 380px; max-height: 280px; object-fit: contain; }
.pdf-page.t-minimal .pdf-cover-author { font-size: 11px; color: #bbb; letter-spacing: 0.15em; margin-top: 20px; }
.pdf-page.t-minimal .pdf-cover-year { font-size: 10px; color: #ddd; margin-top: 6px; }

/* 写真ZINE風PDF */
.pdf-page.t-photo {
  font-family: "Hiragino Sans", sans-serif;
  padding: 40px;
  background: #181820;
  color: #f0f0f0;
}
.pdf-page.t-photo .pdf-pg-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #e0e0e0;
  margin-bottom: 16px;
}
.pdf-page.t-photo .pdf-pg-image { margin: 0 0 16px; text-align: center; }
.pdf-page.t-photo .pdf-pg-image img { max-width: 100%; max-height: 500px; object-fit: cover; border-radius: 3px; }
.pdf-page.t-photo .pdf-pg-body { font-size: 11px; color: #c0c0c0; line-height: 1.9; white-space: pre-wrap; word-break: break-all; }
.pdf-page.t-photo .pdf-pg-caption { font-size: 9.5px; color: #666; margin-top: 10px; font-style: italic; }
.pdf-page.t-photo .pdf-page-num { position: absolute; bottom: 28px; right: 40px; font-size: 10px; color: #444; }
.pdf-page.t-photo.pdf-cover {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding-bottom: 56px;
  position: relative;
}
.pdf-page.t-photo .pdf-cover-bg { position: absolute; inset: 0; }
.pdf-page.t-photo .pdf-cover-bg img { width: 100%; height: 100%; object-fit: cover; opacity: .65; }
.pdf-page.t-photo .pdf-cover-text { position: relative; z-index: 1; }
.pdf-page.t-photo .pdf-cover-title {
  font-size: 38px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
  line-height: 1.2;
  margin-bottom: 10px;
}
.pdf-page.t-photo .pdf-cover-subtitle { font-size: 13px; color: #ddd; margin-bottom: 8px; }
.pdf-page.t-photo .pdf-cover-author { font-size: 12px; color: #aaa; }

/* ══════════════════════════════════════════════
   スリムフッター
   ══════════════════════════════════════════════ */
.app-footer-slim {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 11px 24px;
  flex-shrink: 0;
}

.footer-slim-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-note {
  font-size: 11.5px;
  color: var(--text-muted);
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.footer-link {
  font-size: 12px;
  color: var(--text-sub);
  text-decoration: none;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  transition: all .15s;
}
.footer-link:hover {
  color: var(--blue-dark);
  background: var(--blue-xlight);
}

.footer-sep {
  font-size: 12px;
  color: var(--border-strong);
  padding: 0 2px;
}

/* ══════════════════════════════════════════════
   サブページ共通レイアウト
   ══════════════════════════════════════════════ */
.subpage-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.subpage-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-sub);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all .15s;
  justify-self: start;
  white-space: nowrap;
}
.back-link:hover {
  color: var(--blue-dark);
  border-color: var(--blue);
  background: var(--blue-xlight);
}

.subpage-brand {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.01em;
  justify-self: center;
}

.subpage-main {
  flex: 1;
  padding: 36px 24px 40px;
}

.subpage-content {
  max-width: 1100px;
  margin: 0 auto;
}

.subpage-content-narrow {
  max-width: 680px;
}

.subpage-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: 0.01em;
}

/* ヘルプページ：2×2グリッド */
.help-section-page {
  grid-template-columns: repeat(2, 1fr);
  border-top: none;
  padding: 0;
  background: transparent;
}

@media (max-width: 768px) {
  .help-section-page { grid-template-columns: 1fr; }
  .subpage-header { padding: 10px 14px; }
}

/* ══════════════════════════════════════════════
   利用規約ページ
   ══════════════════════════════════════════════ */
.terms-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.terms-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 10px;
}

.terms-heading {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.terms-body {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.9;
}

.terms-list {
  padding-left: 20px;
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.9;
}
.terms-list li { margin-bottom: 5px; }
.terms-body-mt { margin-top: 8px; }

/* ══════════════════════════════════════════════
   ユーティリティ
   ══════════════════════════════════════════════ */
.hidden { display: none !important; }

.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;
}

/* ══════════════════════════════════════════════
   スクロールバー
   ══════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ══════════════════════════════════════════════
   レスポンシブ
   ══════════════════════════════════════════════ */

/* タブレット（〜1024px）: 左＋中央横並び、プレビュー下 */
@media (max-width: 1024px) {
  .app-main {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .upper-panels {
    display: flex;
    overflow: auto;
    border-bottom: 1px solid var(--border);
  }

  .panel-settings {
    width: 240px;
    min-width: 200px;
    max-height: 560px;
  }

  .panel-pages {
    flex: 1;
    min-width: 220px;
    max-height: 560px;
  }

  .panel-preview {
    min-width: unset;
    width: 100%;
    border-top: none;
    min-height: 480px;
    border-right: none;
  }

  .help-section { grid-template-columns: repeat(2, 1fr); }
}

/* スマホ（〜768px）: 1カラム */
@media (max-width: 768px) {
  .header-row { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .header-note { padding: 6px 14px; }
  .brand-tagline { display: none; }
  .brand-name { font-size: 16px; }

  .header-actions { width: 100%; flex-wrap: wrap; }
  .header-actions .btn { font-size: 12px; height: 34px; }
  .header-actions-sep { display: none; }
  #btn-export-pdf { margin-left: auto; }

  .app-main { flex-direction: column; height: auto; overflow: visible; }
  .panel-settings,
  .panel-pages { width: 100%; min-width: unset; }
  .panel-preview { min-width: unset; width: 100%; min-height: 400px; }

  .preview-page.size-single { width: 260px; height: 369px; }
  .preview-page.size-spread { width: 178px; height: 252px; }

  .help-section { grid-template-columns: 1fr; padding: 14px; }
}

/* さらに狭い場合 */
@media (max-width: 480px) {
  .header-actions .btn { font-size: 11px; padding: 0 10px; }
  #btn-export-pdf { width: 100%; justify-content: center; margin-left: 0; }
  .template-grid { flex-direction: column; }
  .template-card { flex-direction: row; align-items: center; gap: 10px; }
  .template-thumb { width: 44px; height: 62px; }
}
