/* ==========================================================================
   フォトカレンダー作成アプリ — スタイルシート (app.css)
   フォトブックマニア 共通デザインシステム「ネオブルータリズム」適用版。
   ・バターイエロー背景 + 2px インクボーダー + 不透明ベタ影
   ・大原則: 「枠＝影なし ／ 押せるもの＝ハード影＋押し込みインタラクション」
   ・UI はシステムフォント。カレンダー描画(canvas / renderer.js)は一切不変。
   基準: /Users/chihiroweb/Desktop/ネップリテスター/PBM-DESIGN-GUIDE.md
   ========================================================================== */

/* ----- デザイントークン（PBM） ----- */
:root {
  /* テーマカラー：ティール */
  --mint: #5BB4C0;          /* プライマリ（塗りボタン・アクティブ・共通ヘッダー帯） */
  --mint-dark: #3D93A0;     /* ダーク（hover・リンク・アイコン・見出しアクセント） */
  --mint-light: #DBEEF1;    /* ライト（ドラッグ中などのやや濃い薄背景） */
  --mint-lighter: #EAF6F8;  /* ライター（通常の薄背景・作業台・注記） */
  --ink: #2c3a3a;           /* インク（文字・ボーダー・ハード影のすべて） */
  --muted: #566a6a;         /* 補助テキスト（可読性優先で濃いめ） */
  --line: #D6EBEE;          /* 罫線・点線区切り専用（ボーダーには使わない） */
  --bg: #FBE58F;            /* ページ背景（バターイエロー） */
  --white: #ffffff;
  --warn: #e08a3c;

  --radius: 12px;           /* カード角丸（ボタン・入力欄・内箱は 8px） */
  --border: 2px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);      /* 大きいカード級ボタン */
  --shadow-btn: 3px 3px 0 var(--ink);  /* 通常ボタン */
  --shadow-sm: 2px 2px 0 var(--ink);   /* チップ・ピル等の小物 */

  /* 補助実値 */
  --danger: #e05555;
  --footer-text: #4d5c5c;

  /* app.js がインラインstyleで参照する互換エイリアス（絶対に消さない） */
  --accent: var(--mint);
  --text-muted: var(--muted);

  --sidebar-w: 340px;
  --header-h: 60px;
}

/* ----- リセット ----- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden; /* モバイルで横スクロールを出さない */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* ==========================================================================
   全体レイアウト
   ========================================================================== */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* PBM 共通ヘッダーの挿入枠（帯自体は pbm-header.js が全幅で描画） */
#pbm-header { flex: 0 0 auto; }

/* ----- 自作ヘッダー（PBM帯の下・アプリ名バー） ----- */
.app-header {
  flex: 0 0 auto;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 20px;
  background: var(--bg);
  border-bottom: var(--border);
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-mark {
  color: var(--mint-dark);
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}
.brand-mark img {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: contain;
}
.brand-text { min-width: 0; }
.brand-title {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--ink);
  white-space: nowrap;
}
.brand-sub {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

/* プライバシー安心ピル（情報表示・押せない＝枠のみ／影なし） */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 5px 12px;
  border: var(--border);
  border-radius: 999px;
  font-weight: 700;
  background: var(--white);
  color: var(--ink);
}
.pill-safe {
  background: var(--mint-lighter);
  color: var(--mint-dark);
}
.pill i { font-size: 11px; color: var(--mint-dark); }

.brand-note {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

/* プライバシー安心のマスコット吹き出し（ネップリ補正ツール PBM-DESIGN-GUIDE
   吹き出し「方式A」を移植。ヘッダーはカード背景が白のため、hm-bubble自体は
   白背景のまま識別できるよう軽いソフトシャドウのみ付与＝ハード影(--shadow系)は使わない） */
.header-mascot {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.hm-icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: block;
}
.hm-bubble {
  position: relative;
  min-width: 0;
  flex: 1 1 auto;
  background: #fff;
  border: none;
  border-radius: 10px;
  padding: 6px 10px;
  box-shadow: 0 1px 4px rgba(44, 58, 58, 0.18);
}
/* 左向きしっぽ（マスコットを指す。枠線なしの白い三角形のみ） */
.hm-bubble::after {
  content: "";
  position: absolute;
  top: 50%;
  left: -6px;
  transform: translateY(-50%);
  border-style: solid;
  border-width: 5px 7px 5px 0;
  border-color: transparent #fff transparent transparent;
}
.hm-bubble p {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.5;
}
.hm-link {
  display: inline-block;
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--mint-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.hm-link:hover { color: var(--ink); }

/* テキストリンク風ボタン（免責事項リンクなど） */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--mint-dark);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--ink); }
.link-btn i { font-size: 12px; }

.link-btn-inline {
  font-size: inherit;
  font-weight: 800;
  color: var(--mint-dark);
  margin: 0 1px;
}
.disclaimer-hint { margin-top: 8px; }

/* ----- ワークスペース（2ペイン） ----- */
.workspace {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

/* ==========================================================================
   サイドバー（バターイエロー地に白のパネルカードを並べる）
   ========================================================================== */
.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  background: var(--bg);
  border-right: var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px 44px;
}
.sidebar::-webkit-scrollbar { width: 10px; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--mint-dark);
  border-radius: 999px;
  border: 3px solid var(--bg);
}

/* ----- パネル＝カード（枠系：影なし・2pxインクボーダー） ----- */
.panel {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  margin-bottom: 14px;
  overflow: hidden;
}
.panel-head {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  min-height: 48px;
  font-weight: 800;
  font-size: 14px;
  color: var(--ink);
  user-select: none;
}
.panel-head::-webkit-details-marker { display: none; }
.panel-head:hover { background: var(--mint-lighter); }
.panel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  color: var(--mint-dark);
  flex: 0 0 auto;
}
.panel-title { flex: 1; }

/* 開閉インジケータ（シェブロン） */
.panel-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  flex: 0 0 auto;
}
.panel[open] .panel-chevron { transform: rotate(45deg); }

.panel[open] .panel-head { border-bottom: var(--border); }

.panel-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==========================================================================
   フォーム部品
   ========================================================================== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field-label,
.field-label-row .field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}
.field-help {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* 汎用コントロール（select / input＝内箱 8px・2pxインク枠） */
.control {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--white);
  border: var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  transition: outline-color 0.12s ease;
  appearance: none;
  -webkit-appearance: none;
}
select.control {
  /* ネイティブ矢印(▼)相当を自前で。文字と重ならないよう右余白を確保 */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%232c3a3a' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.control:focus {
  outline: 2px solid var(--mint-dark);
  outline-offset: 1px;
}

/* ----- 月選択トグル（12個の押しボタン） ----- */
.mini-actions { display: flex; gap: 6px; }
.mini-btn {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--mint-dark);
  background: var(--white);
  border: var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s, box-shadow 0.08s;
}
.mini-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.month-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.month-toggle {
  position: relative;
  cursor: pointer;
}
.month-toggle input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.month-toggle span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  background: var(--white);
  border: var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s, box-shadow 0.08s, background 0.1s, color 0.1s;
}
.month-toggle input:checked + span {
  color: #fff;
  background: var(--mint);
}
.month-toggle input:active + span {
  transform: translate(2px, 2px);
  box-shadow: none;
}
.month-toggle input:focus-visible + span {
  outline: 2px solid var(--mint-dark);
  outline-offset: 2px;
}

/* ----- スイッチ（六曜など） ----- */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding-top: 2px;
  min-height: 32px;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative;
  width: 46px;
  height: 26px;
  background: var(--white);
  border: var(--border);
  border-radius: 999px;
  transition: background 0.16s ease;
  flex: 0 0 auto;
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--ink);
  border-radius: 50%;
  transition: transform 0.16s ease, background 0.16s ease;
}
.switch input:checked + .switch-track {
  background: var(--mint);
}
.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(20px);
  background: #fff;
}
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--mint-dark);
  outline-offset: 2px;
}
.switch-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

/* ==========================================================================
   ボタン（押せるもの：2pxインク枠＋不透明ハード影＋押し込み）
   ========================================================================== */
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--mint);
  border: var(--border);
  border-radius: 8px;
  padding: 10px 15px;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: transform 0.08s, box-shadow 0.08s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn i { font-size: 0.95em; }
@media (hover: hover) {
  .btn:hover:not(:disabled) {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--ink);
  }
}
.btn:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--mint);
  color: #fff;
}
.btn-secondary {
  background: var(--white);
  color: var(--mint-dark);
}
.btn-add {
  align-self: flex-start;
  background: var(--white);
  color: var(--mint-dark);
  padding: 8px 14px;
}

/* 大ボタン（書き出し等）＝ベース4px影・ワンサイズ大きい押し込み */
.btn-lg {
  width: 100%;
  padding: 13px 16px;
  font-size: 15px;
  box-shadow: var(--shadow);
}
@media (hover: hover) {
  .btn-lg:hover:not(:disabled) {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 var(--ink);
  }
  .btn-lg.btn-primary:hover:not(:disabled) { background: #4AA6B3; }
}
.btn-lg:active:not(:disabled) {
  transform: translate(4px, 4px);
  box-shadow: none;
}
.btn-lg.btn-primary:active:not(:disabled) { background: var(--mint-dark); }

/* ==========================================================================
   写真セクション
   ========================================================================== */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 10px 18px;
  background: var(--mint-lighter);
  border: 3px dashed #9aa5a5;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover {
  border-color: var(--mint-dark);
  background: var(--mint-light);
}
.dropzone-icon {
  font-size: 38px;
  line-height: 1;
  color: var(--mint-dark);
  margin-bottom: 4px;
}
.dropzone-main { font-weight: 800; font-size: 16px; color: var(--ink); }
.dropzone-sub { font-size: 13px; color: var(--muted); }
/* プライバシー明示ピル（情報表示・枠のみ／影なし） */
.dropzone-privacy {
  display: inline-block;
  margin-top: 10px;
  padding: 5px 11px;
  background: var(--white);
  color: var(--mint-dark);
  border: var(--border);
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: -0.01em;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  max-width: 100%;
}
.dropzone-privacy i { font-size: 10px; margin-right: 3px; }
.dropzone-privacy .dz-pill-seg { white-space: nowrap; }

/* 写真リスト（月ごとの割当。中身は app.js が生成） */
.photo-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.photo-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px;
  background: var(--mint-lighter);
  border: var(--border);
  border-radius: 8px;
}
.photo-thumb {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--line);
  border: var(--border);
}
.photo-controls {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
}
.photo-controls input[type="range"] {
  width: 100%;
  accent-color: var(--mint);
}

/* ==========================================================================
   配色（パレットカード＝押せるカード）
   ========================================================================== */
.palette-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.palette-card {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  padding: 8px 8px 9px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s, box-shadow 0.08s;
}
@media (hover: hover) {
  .palette-card:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--ink);
  }
}
.palette-card:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

/* 色帯（swatch）を横に並べる */
.palette-swatch {
  display: flex;
  height: 30px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid var(--ink);
}
.palette-swatch > span { flex: 1 1 0; }
.palette-name {
  display: block;
  margin-top: 7px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 選択中パレット（インクの内側リング＝ぼかしなし） */
.palette-card.selected {
  box-shadow: var(--shadow-sm), inset 0 0 0 3px var(--mint);
}
.palette-card.selected .palette-name {
  color: var(--mint-dark);
  font-weight: 800;
}

/* ==========================================================================
   文字とフォント（フォントプレビューボタン＝押せるカード）
   ========================================================================== */
.font-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.font-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  padding: 10px 8px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s, box-shadow 0.08s;
  font-family: inherit;
}
@media (hover: hover) {
  .font-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--ink);
  }
}
.font-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}
.font-btn:focus-visible {
  outline: 2px solid var(--mint-dark);
  outline-offset: 2px;
}
.font-btn-sample {
  /* サンプル字は各フォントで表示（カレンダー用フォント選択機能を維持） */
  font-size: 18px;
  line-height: 1.3;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.font-btn-name {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.font-btn.selected {
  box-shadow: var(--shadow-sm), inset 0 0 0 3px var(--mint);
}
.font-btn.selected .font-btn-name {
  color: var(--mint-dark);
  font-weight: 800;
}

/* ----- 区切り（ラベル付き。罫線は --line 専用色） ----- */
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  margin: 2px 0;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--line);
}

/* ----- カスタムカラー ----- */
.custom-colors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.color-field {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.color-field input[type="color"] {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: var(--border);
  border-radius: 6px;
  background: none;
  cursor: pointer;
}
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.color-field input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}
.color-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}

/* ==========================================================================
   記念日・自由テキスト
   ========================================================================== */
.anniv-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.anniv-date {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* 登録済みリスト（チップ＝枠のみ小物） */
.chip-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chip-list .chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--mint-lighter);
  border: var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}
.chip .chip-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip .chip-date {
  color: var(--mint-dark);
  font-weight: 800;
  font-size: 12.5px;
}
.chip .chip-remove {
  flex: 0 0 auto;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px;
  border-radius: 4px;
}
.chip .chip-remove:hover { color: var(--danger); }

/* 空状態のヒント */
.empty-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 2px;
  list-style: none;
}

/* ==========================================================================
   テンプレートセクション（グリッド / マスク カード＝押せるカード）
   ========================================================================== */
.template-hint {
  margin: 2px 0 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.template-hint i { color: var(--mint-dark); margin-right: 3px; }
/* マスクのタップ適用で対象写真が特定できないときの一時強調 */
.template-hint.hint-attn {
  color: var(--danger);
  font-weight: 700;
  transition: color 0.15s;
}

.grid-card-list,
.mask-card-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.grid-card,
.mask-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px 8px;
  background: var(--white);
  border: var(--border);
  border-radius: 8px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s, box-shadow 0.08s;
}
@media (hover: hover) {
  .grid-card:hover,
  .mask-card:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--ink);
  }
}
.grid-card:active,
.mask-card:active { cursor: grabbing; }
.grid-card.dragging,
.mask-card.dragging { opacity: 0.45; }
.grid-card.selected {
  box-shadow: var(--shadow-sm), inset 0 0 0 3px var(--mint);
}
.grid-card-name,
.mask-card-name {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.grid-card.selected .grid-card-name { color: var(--mint-dark); }

/* グリッド配置図（枠線の分割図） */
.grid-diagram {
  display: grid;
  gap: 2.5px;
  width: 44px;
  height: 34px;
}
.grid-diagram span {
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: var(--mint-lighter);
  min-width: 0;
  min-height: 0;
}
.grid-diagram--single { grid-template: 1fr / 1fr; }
.grid-diagram--grid2 { grid-template: 1fr / 1fr 1fr; }
.grid-diagram--grid3 { grid-template: 1fr 1fr / 1.6fr 1fr; }
.grid-diagram--grid3 .g3-big { grid-row: 1 / 3; }
.grid-diagram--grid4 { grid-template: 1fr 1fr / 1fr 1fr; }

/* マスク形状シルエット */
.mask-shape {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--ink);
}
.mask-shape--none {
  border: 2px dashed var(--muted);
  border-radius: 2px;
  width: 30px;
  height: 30px;
}
.mask-shape--rounded {
  background: currentColor;
  border-radius: 6px;
  width: 30px;
  height: 30px;
}
.mask-shape--circle {
  background: currentColor;
  border-radius: 50%;
  width: 30px;
  height: 30px;
}
.mask-shape--heart svg {
  width: 30px;
  height: 28px;
  display: block;
}

/* 写真一覧のマスク小表示バッジ */
.mask-mini {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.mask-mini--none {
  border: 2px dashed var(--muted);
  border-radius: 2px;
  width: 13px;
  height: 13px;
}
.mask-mini--rounded {
  background: var(--muted);
  border-radius: 4px;
  width: 13px;
  height: 13px;
}
.mask-mini--circle {
  background: var(--muted);
  border-radius: 50%;
  width: 13px;
  height: 13px;
}
.mask-mini--heart { font-size: 13px; }

/* ==========================================================================
   プレビューエリア（作業台）
   ========================================================================== */
.preview {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--mint-lighter);
}

/* ページ送りバー（カレンダープレビューの下・作業台と同色で一体化） */
.preview-bar {
  flex: 0 0 auto;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--mint-lighter);
}
.page-nav {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: var(--border);
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s, box-shadow 0.08s;
}
@media (hover: hover) {
  .page-nav:hover:not(:disabled) {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--ink);
  }
}
.page-nav:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: none;
}
.page-nav:disabled {
  opacity: 0.4;
  cursor: default;
}
.page-indicator {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  min-width: 64px;
  text-align: center;
}

/* 作業台に canvas を中央配置 */
.canvas-stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  position: relative;
}

/* プレビュー画像枠＝枠系（2pxインク・影なし） */
.preview-canvas {
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  border: var(--border);
  box-shadow: none;
  border-radius: 2px;
}

/* ファイルD&D: スロットハイライト（対象スロットの枠） */
.drop-slot-highlight {
  position: absolute;
  pointer-events: none;
  border: 3px solid var(--mint-dark);
  border-radius: 4px;
  background: var(--mint-light);
  z-index: 6;
  transition: opacity 0.08s ease;
}
.drop-hint[hidden],
.drop-slot-highlight[hidden] { display: none !important; }

/* ファイルD&D: 全体オーバーレイ（スロット外に落とす場合） */
.drop-hint {
  position: absolute;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px dashed var(--mint-dark);
  border-radius: 4px;
  background: rgba(234, 246, 248, 0.72);
  z-index: 6;
}
.drop-hint-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  border-radius: 8px;
  background: var(--mint);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  border: var(--border);
  box-shadow: var(--shadow);
}
.drop-hint-inner i { font-size: 24px; }

/* サイドバードロップゾーン: ファイルドラッグ中の受付表示 */
.dropzone.dragover {
  border-color: var(--mint-dark);
  background: var(--mint-light);
  border-style: solid;
}

/* サムネイルD&D */
.photo-thumb[draggable="true"] { cursor: grab; }
.photo-thumb[draggable="true"]:active { cursor: grabbing; }
.photo-item.dragging { opacity: 0.45; }

/* 写真の選択UI（選択枠 + ズームピル + 入れ替えハンドル + ゴースト） */
.photo-select-outline {
  position: absolute;
  pointer-events: none;
  border: 2px solid var(--mint-dark);
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px var(--white);
  z-index: 5;
}
.photo-select-outline[hidden] { display: none !important; }

.zoom-pill {
  position: absolute;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #fff;
  border: var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-btn);
}
.zoom-pill[hidden] { display: none !important; }
.zoom-pill > i { color: var(--muted); font-size: 11px; }
.zoom-pill input[type="range"] {
  width: 120px;
  margin: 0;
  accent-color: var(--mint);
}
.photo-move-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: var(--border);
  border-radius: 50%;
  background: var(--mint);
  color: #fff;
  font-size: 12px;
  cursor: grab;
  touch-action: none;
}
.photo-move-handle:hover { background: var(--mint-dark); }
.photo-move-handle:active { cursor: grabbing; }

.swap-ghost {
  position: absolute;
  z-index: 9;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: var(--border);
  box-shadow: var(--shadow-sm);
  opacity: 0.7;
  pointer-events: none;
}
.swap-ghost[hidden] { display: none !important; }

/* ==========================================================================
   当サイト限定クーポン
   PC（>1000px）はプレビュー下（#coupon-desktop）、モバイル（≤1000px）はツール下・FAQ上
   （#coupon-mobile）に表示。中身は同一で、どちらか一方のみを media query で出し分ける
   （重複表示防止）。
   ========================================================================== */
.coupon-dock--mobile { display: none; }
@media (max-width: 1000px) {
  .coupon-dock--desktop { display: none; }
  .coupon-dock--mobile { display: block; }
}

.coupon-dock--desktop {
  flex: 0 0 auto;
  padding: 14px 20px 18px;
  background: var(--white);
  border-top: var(--border);
}
.coupon-dock--mobile {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px 0;
}

.coupon-card { min-width: 0; }
.coupon-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}
.coupon-head i { color: var(--mint-dark); font-size: 14px; }
.coupon-sub { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 4px; }

/* 見出しの✨：上品なきらめき（scale＋opacity＋微回転のゆらめき） */
.sparkle {
  display: inline-block;
  margin: 0 1px 0 3px;
  animation: sparkleTwinkle 1.4s ease-in-out infinite alternate;
}
@keyframes sparkleTwinkle {
  from { transform: scale(0.8) rotate(-8deg); opacity: 0.6; }
  to   { transform: scale(1.15) rotate(8deg); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .sparkle { animation: none; }
}

.coupon-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  background: var(--mint-lighter);
  border: var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s, box-shadow 0.08s;
}
@media (hover: hover) {
  .coupon-banner:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--ink);
  }
}
.coupon-banner:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}
.coupon-banner-badge {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  background: var(--mint);
  color: #fff;
  border: var(--border);
  border-radius: 50%;
  font-weight: 800;
  font-size: 16px;
  line-height: 1.1;
}
.coupon-banner-badge small { font-size: 9px; font-weight: 700; }
.coupon-banner-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.coupon-banner-title { font-size: 13.5px; font-weight: 800; color: var(--ink); }
.coupon-banner-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }
.coupon-banner-arrow { flex: 0 0 auto; color: var(--mint-dark); font-size: 14px; }

/* 動的クーポン一覧（js/coupons.js が取得成功時のみ .coupon-card に is-dynamic を付与して
   静的バナーと差し替える。既定（取得前・取得失敗時）は非表示のままで、上の静的バナーが
   フォールバックとして表示され続ける）。 */
.coupon-scroll {
  display: none;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 4px 2px 8px;
  -webkit-overflow-scrolling: touch;
}
.coupon-card.is-dynamic .coupon-scroll { display: flex; }
.coupon-card.is-dynamic .coupon-banner { display: none; }
.coupon-scroll::-webkit-scrollbar { height: 6px; }
.coupon-scroll::-webkit-scrollbar-track { background: var(--mint-lighter); border-radius: 3px; }
.coupon-scroll::-webkit-scrollbar-thumb { background: var(--mint); border-radius: 3px; }
.coupon-item { flex: 0 0 auto; scroll-snap-align: start; display: block; }
.coupon-item img {
  height: 90px; width: auto; display: block;
  border: none; border-radius: 8px;
}
.coupon-more {
  flex: 0 0 auto; scroll-snap-align: start;
  display: flex; align-items: center; justify-content: center;
  height: 90px; padding: 0 16px;
  background: var(--mint-lighter); border: var(--border);
  border-radius: 8px; color: var(--mint-dark);
  font-weight: 700; font-size: 13px; text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s, box-shadow 0.08s;
}
@media (hover: hover) {
  .coupon-more:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
}
.coupon-more:active { background: var(--mint-light); transform: translate(2px, 2px); box-shadow: none; }

/* ==========================================================================
   免責事項モーダル（下からのシート → 560px以上で中央）
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 40, 36, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }

.modal-card {
  background: var(--white);
  border: var(--border);
  box-shadow: none;
  border-radius: 12px 12px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: var(--border);
}
.modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--mint-lighter);
  border: var(--border);
  color: var(--mint-dark);
  font-size: 15px;
  flex: 0 0 auto;
}
.modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}

.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 22px;
  line-height: 1.7;
}

.disclaimer-text h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}
.disclaimer-text h4 {
  margin: 16px 0 4px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--mint-dark);
}
.disclaimer-text h4:first-of-type { margin-top: 4px; }
.disclaimer-text p {
  margin: 0;
  font-size: 13px;
  line-height: 1.75;
  color: var(--muted);
}
.disclaimer-list {
  margin: 0;
  padding-left: 1.3em;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.disclaimer-list li {
  font-size: 13px;
  line-height: 1.75;
  color: var(--muted);
}

.modal-footer {
  flex: 0 0 auto;
  padding: 16px 22px 20px;
  border-top: var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-footer [hidden] { display: none !important; }

.modal-agree {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.modal-agree input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--mint);
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-actions .btn { width: auto; }

@media (min-width: 560px) {
  .modal-overlay { align-items: center; padding: 24px; }
  .modal-card { border-radius: 12px; }
}

/* 「アップロードされない仕組み」モーダル：note風の箇条書きボックス（ネップリテスターの .dm-body 相当） */
.privacy-mechanism-note {
  border: var(--border);
  border-radius: 8px;
  background: var(--mint-lighter);
  padding: 12px 14px;
}
.privacy-mechanism-note .disclaimer-list li { color: var(--ink); }

/* ==========================================================================
   よくある質問（FAQ）セクション
   ========================================================================== */
.faq-section {
  background: var(--bg);
  border-top: var(--border);
  padding: 48px 20px 60px;
}
.faq-inner {
  max-width: 800px;
  margin: 0 auto;
}
.faq-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 24px;
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
}
.faq-heading i { color: var(--mint-dark); font-size: 19px; }

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* FAQ アコーディオン（details レシピ・枠系＝影なし） */
.faq-item {
  background: var(--white);
  border: var(--border);
  border-radius: 8px;
  box-shadow: none;
  overflow: hidden;
}
.faq-q {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  min-height: 48px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  user-select: none;
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q:hover { background: var(--mint-lighter); }
.faq-q-icon {
  flex: 0 0 auto;
  font-size: 15px;
  color: var(--mint-dark);
}
.faq-q > span:not(.faq-chevron) { flex: 1 1 auto; }
.faq-chevron {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}
.faq-item[open] .faq-chevron { transform: rotate(45deg); }
.faq-item[open] .faq-q { border-bottom: 1px dashed var(--line); }
.faq-a {
  padding: 12px 16px 16px 40px;
}
.faq-a p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--muted);
}
.faq-a-link {
  color: var(--mint-dark);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.faq-a-link:hover { color: var(--ink); }

/* 蛍光マーカー */
.faq-marker,
mark {
  background: linear-gradient(transparent 55%, rgba(255, 226, 92, 0.85) 55%);
  font-weight: 600;
  color: inherit;
  padding: 0 1px;
}

/* ==========================================================================
   更新履歴セクション（FAQと同トーンの控えめなリスト）
   ========================================================================== */
.changelog-section {
  background: var(--bg);
  border-top: var(--border);
  padding: 28px 20px 36px;
}
.changelog-inner {
  max-width: 800px;
  margin: 0 auto;
}
.changelog-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 800;
  color: var(--muted);
}
.changelog-heading i { color: var(--mint-dark); font-size: 13px; }

.changelog-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.changelog-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 2px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
  border-bottom: 1px dashed var(--line);
}
.changelog-item:last-child { border-bottom: none; }
.changelog-date {
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--ink);
}
.changelog-text { flex: 1 1 auto; }

/* ==========================================================================
   フッター（バターイエロー地・上辺インクボーダー）
   ========================================================================== */
.site-footer {
  background: var(--bg);
  border-top: var(--border);
  padding: 20px;
}
.footer-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--mint-dark);
  text-decoration: none;
}
.footer-link:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footer-link i { font-size: 12px; }
.footer-credit {
  margin: 0;
  font-size: 11px;
  color: var(--footer-text);
}
.footer-credit-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footer-credit-link:hover {
  color: var(--mint-dark);
}

/* ==========================================================================
   レスポンシブ
   横1000px 未満でサイドバーを上に積む
   ========================================================================== */
@media (max-width: 1000px) {
  .app {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .workspace {
    flex-direction: column;
    overflow: visible;
  }
  /* モバイルではプレビューを操作パネルより上に表示する（DOM順は変えず order で入れ替え） */
  .preview {
    order: 1;
    flex: 0 0 auto;
    border-bottom: var(--border);
  }
  /* 作業台の高さは canvas（画面幅基準）に追従させ、はみ出しはページスクロールで見せる。
     55vh 制限は撤廃し、プレビューがまず大きく見えることを優先。 */
  .canvas-stage {
    overflow: visible;
    padding: 16px;
  }
  .preview-canvas {
    max-height: none;
  }
  /* ----- モバイル: 編集メニューは下端固定ドック + ボトムシートへ ----- */
  /* パネル群はシート表示時に DOM ごと移動されるため、サイドバー自体は隠す
     （DOM は残るので app.js の動的生成・配線はそのまま生きる）。 */
  .sidebar {
    order: 2;
    display: none;
  }
  /* 下端固定バーに隠れないよう本文へ下パディング（FAQ・フッターも読める） */
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  /* 下端固定のアイコンツールバー（卒園アルバム風・横スクロール可） */
  .mobile-dock {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    gap: 8px;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: var(--bg);
    border-top: var(--border);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .mobile-dock::-webkit-scrollbar { display: none; }

  /* セクションのボトムシート（下からせり上がる。ドックは見えたまま） */
  .mobile-sheet {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    /* bottom はドック高に合わせて JS が指定 */
    z-index: 70;
  }
  .mobile-sheet[hidden] { display: none !important; }
  .mobile-sheet-backdrop {
    /* 施主指摘: 背景を暗くしない。外タップで閉じる判定用のヒット領域として
       透明のまま残す（クリックイベントは backdrop.addEventListener で結線済み）。 */
    position: absolute;
    inset: 0;
    background: transparent;
  }
  .mobile-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-top: var(--border);
    border-left: var(--border);
    border-right: var(--border);
    border-radius: 16px 16px 0 0;
    /* 暗幕をやめた分、シート自体の輪郭を強めて視認性を確保（PBM意匠のハード影）。 */
    box-shadow: 0 -4px 0 var(--ink), 0 -14px 28px rgba(20, 40, 36, 0.16);
    transform: translateY(105%);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .mobile-sheet.open .mobile-sheet-panel { transform: translateY(0); }
  .mobile-sheet-grip {
    flex: 0 0 auto;
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: var(--line);
    margin: 8px auto 2px;
    touch-action: none;
  }
  .mobile-sheet-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 16px 10px;
    border-bottom: var(--border);
  }
  .mobile-sheet-title {
    font-weight: 800;
    font-size: 15px;
    color: var(--ink);
  }
  .mobile-sheet-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--mint-lighter);
    border: var(--border);
    border-radius: 8px;
    color: var(--mint-dark);
    font-size: 14px;
    cursor: pointer;
  }
  .mobile-sheet-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  }
  /* シート内のパネル: アコーディオン見出しは隠し、枠・影も外して内容だけ見せる */
  .mobile-sheet-body .panel {
    border: none;
    background: transparent;
    border-radius: 0;
    margin-bottom: 0;
    box-shadow: none;
    overflow: visible;
    display: block;
  }
  .mobile-sheet-body .panel-head { display: none; }
  .mobile-sheet-body .panel-body { padding: 2px 0 8px; }

  /* シート内の配色・フォント一覧は横1行スクロールにして縦の高さを抑える
     （右端が少し見切れるパディングで「まだ続きがある」ことを示す） */
  .mobile-sheet-body .palette-list,
  .mobile-sheet-body .font-list {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    gap: 10px;
    padding: 2px 2px 10px;
  }
  .mobile-sheet-body .palette-list::-webkit-scrollbar,
  .mobile-sheet-body .font-list::-webkit-scrollbar { height: 6px; }
  .mobile-sheet-body .palette-list::-webkit-scrollbar-track,
  .mobile-sheet-body .font-list::-webkit-scrollbar-track { background: var(--mint-lighter); border-radius: 3px; }
  .mobile-sheet-body .palette-list::-webkit-scrollbar-thumb,
  .mobile-sheet-body .font-list::-webkit-scrollbar-thumb { background: var(--mint); border-radius: 3px; }
  .mobile-sheet-body .palette-card {
    flex: 0 0 auto;
    scroll-snap-align: start;
    width: 150px;
  }
  .mobile-sheet-body .font-btn {
    flex: 0 0 auto;
    scroll-snap-align: start;
    width: 140px;
  }

  /* ドックのボタン（既存チップ意匠 .msec-chip を流用。
     編集モード下部ツールバー（.editor-tool）とトーン統一） */
  .msec-chip {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 62px;
    padding: 8px 10px;
    background: var(--white);
    border: 2px solid var(--ink);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    font-family: inherit;
    font-weight: 700;
    font-size: 11px;
    line-height: 1.2;
    color: var(--ink);
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.08s, box-shadow 0.08s;
  }
  .msec-chip-icon { color: var(--mint-dark); font-size: 18px; line-height: 1; }
  .msec-chip.is-active {
    background: var(--mint);
    color: #fff;
  }
  .msec-chip.is-active .msec-chip-icon { color: #fff; }
  .msec-chip:active {
    transform: translate(1px, 1px);
    box-shadow: none;
  }
}

/* ドック・シートはデスクトップでは常に非表示（従来アコーディオン完全維持） */
@media (min-width: 1001px) {
  .mobile-dock, .mobile-sheet { display: none !important; }
}

@media (max-width: 560px) {
  .app-header {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .brand-note {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }
  .hm-icon { width: 40px; height: 40px; }
  .hm-bubble { padding: 5px 8px; }
  .hm-bubble p { font-size: 10px; }
  .hm-link { font-size: 9.5px; }
  .canvas-stage { padding: 18px; }
}

/* ==========================================================================
   Canva風・全画面編集モード（仕様追加v6）
   PBMネオブルータリズム: 2pxインク枠・ハード影・原色ベタ回避。
   ========================================================================== */
.editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;                 /* 免責モーダル(100)より前面 */
  display: flex;
  flex-direction: column;
  background: var(--mint-lighter); /* 下地=作業台色 */
}
.editor-overlay[hidden] { display: none !important; }

/* 上部バー */
.editor-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: var(--border);
}
.editor-title {
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
}
.editor-done {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  background: var(--mint);
  border: var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: transform 0.08s, box-shadow 0.08s;
}
@media (hover: hover) {
  .editor-done:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); background: var(--mint-dark); }
}
.editor-done:active { transform: translate(2px, 2px); box-shadow: none; }

/* 編集ステージ（canvas 中央 + ハンドル層） */
.editor-stage {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
}
.editor-canvas {
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  border: var(--border);
  border-radius: 2px;
  touch-action: none;
}
.editor-handles {
  position: absolute;
  inset: 0;
  pointer-events: none; /* 子（selbox/handle）のみ受ける */
}
.editor-selbox {
  position: absolute;
  pointer-events: auto;
  cursor: move;
  border: 2px solid var(--mint);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.85);
  touch-action: none;
}
.editor-selbox[hidden] { display: none !important; }
.editor-handle {
  position: absolute;
  width: 20px;
  height: 20px;
  transform: translate(-50%, -50%);
  background: #fff;
  border: 2px solid var(--mint-dark);
  pointer-events: auto;
  touch-action: none;
  padding: 0;
  z-index: 2;
}
.editor-handle[hidden] { display: none !important; }
/* 四隅=丸 / 辺中央=ピル形（施主スクショ準拠） */
.editor-handle.corner { border-radius: 50%; cursor: nwse-resize; }
.editor-handle[data-h="ne"], .editor-handle[data-h="sw"] { cursor: nesw-resize; }
.editor-handle[data-h="n"], .editor-handle[data-h="s"] { width: 26px; height: 14px; border-radius: 999px; cursor: ns-resize; }
.editor-handle[data-h="e"], .editor-handle[data-h="w"] { width: 14px; height: 26px; border-radius: 999px; cursor: ew-resize; }

/* 枠右下の円形ゴミ箱ボタン（PBM意匠: 赤系・2pxインク枠・ベタ影）。
   SEハンドルの内側寄りに配置し、リサイズ操作と干渉しない。 */
.editor-slot-trash {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  color: var(--danger);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  z-index: 3;
}
.editor-slot-trash i { font-size: 13px; color: var(--danger); }
.editor-slot-trash:hover { background: var(--danger); }
.editor-slot-trash:hover i { color: #fff; }
.editor-slot-trash:active { transform: translate(-50%, -50%) translate(1px, 1px); box-shadow: none; }
.editor-slot-trash[hidden] { display: none !important; }

/* 下部ツールバー（アイコン+ラベル） */
.editor-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--white);
  border-top: var(--border);
  overflow-x: auto;
}
.editor-tool {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 62px;
  padding: 8px 8px;
  background: var(--white);
  border: var(--border);
  border-radius: 8px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.08s, box-shadow 0.08s;
}
.editor-tool i { font-size: 16px; color: var(--mint-dark); }
@media (hover: hover) {
  .editor-tool:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
}
.editor-tool:active { transform: translate(2px, 2px); box-shadow: none; }
.editor-tool.is-danger i { color: var(--danger); }
.editor-tool.is-primary { background: var(--mint); color: #fff; }
.editor-tool.is-primary i { color: #fff; }

/* 狭い画面ではツールバーを均等分割して全項目を収める（横スクロール不要に） */
@media (max-width: 560px) {
  .editor-toolbar { gap: 4px; padding-left: 6px; padding-right: 6px; justify-content: stretch; }
  .editor-tool { flex: 1 1 0; min-width: 0; padding: 8px 2px; font-size: 10px; }
  .editor-tool i { font-size: 15px; }
}

/* ボトムシート */
.editor-sheet {
  position: absolute;
  inset: 0;
  z-index: 3;
}
.editor-sheet[hidden] { display: none !important; }
.editor-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 40, 36, 0.35);
}
.editor-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 76%;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-top: var(--border);
  border-left: var(--border);
  border-right: var(--border);
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.editor-sheet.open .editor-sheet-panel { transform: translateY(0); }
.editor-sheet-grip {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  margin: 8px auto 2px;
}
.editor-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 18px 10px;
  border-bottom: var(--border);
}
.editor-sheet-title { font-weight: 800; font-size: 15px; color: var(--ink); }
.editor-sheet-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--mint-lighter);
  border: var(--border);
  border-radius: 8px;
  color: var(--mint-dark);
  cursor: pointer;
}
.editor-sheet-body {
  overflow-y: auto;
  padding: 16px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.editor-sheet-body .es-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.editor-sheet-body .es-row > span { flex: 0 0 auto; color: var(--muted); min-width: 52px; }
.editor-sheet-body input[type="range"] { flex: 1 1 auto; accent-color: var(--mint); }
.editor-sheet-body input[type="color"] {
  width: 48px; height: 36px; padding: 0;
  border: var(--border); border-radius: 8px; background: #fff; cursor: pointer;
}
.editor-sheet-body textarea,
.editor-sheet-body select {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  border: var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}
.editor-sheet-body textarea { min-height: 72px; resize: vertical; }
.editor-sheet-hint { font-size: 12px; color: var(--muted); }

/* マスクカード（シート内） */
.es-mask-grid, .es-swap-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.es-swap-grid { grid-template-columns: repeat(3, 1fr); }
.es-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  background: var(--white);
  border: var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.es-card.selected { background: var(--mint-light); border-color: var(--mint-dark); }
.es-card .es-mask-shape {
  width: 34px; height: 34px; background: var(--mint-dark);
}
.es-card .es-mask-shape.rounded { border-radius: 8px; }
.es-card .es-mask-shape.circle { border-radius: 50%; }
.es-card .es-mask-shape.none { background: none; border: 2px solid var(--mint-dark); }
.es-card .es-mask-shape.heart { background: none; color: var(--mint-dark); font-size: 30px; line-height: 34px; }
.es-swap-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid var(--ink);
  display: block;
}
.es-card.empty-slot { color: var(--muted); }
.es-reset-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-weight: 800; font-size: 13px; color: var(--mint-dark);
  background: var(--mint-lighter); border: var(--border); border-radius: 8px;
  padding: 10px 14px; cursor: pointer; box-shadow: var(--shadow-sm);
}

/* ---- v6.2 PCインライン編集（>1000px: サイドバーを保持したままメインプレビューで編集） ---- */
/* ハンドル層・ツールバー・シートは app.js が .canvas-stage / .preview へ付け替える。 */
body.inline-editing .preview { position: relative; }
/* ツールバー: プレビューエリア下部のバー（編集中のみ表示） */
.preview > .editor-toolbar { display: none; }
body.inline-editing .preview > .editor-toolbar { display: flex; }
/* シート: ツールバーの上に開く（bottom は app.js がツールバー高で指定）。
   ステージ内オーバーレイ（ズームピル z8 等）より前面へ。 */
body.inline-editing .preview > .editor-sheet { z-index: 30; }
/* ハンドル層はメインステージでも同じ座標系（絶対配置・クリック透過）で機能する */
.canvas-stage > .editor-handles { z-index: 7; }

/* ---- v6.1 トリミング（切り抜き）モード ---- */
/* 画像境界ボックス（フレーム外のゴースト範囲を囲む。ドラッグ=パン） */
.editor-cropbox {
  position: absolute;
  pointer-events: auto;
  cursor: move;
  border: 2px dashed rgba(61, 147, 160, 0.9); /* mint-dark */
  touch-action: none;
  z-index: 1;
}
.editor-cropbox[hidden] { display: none !important; }
/* 画像四隅の拡縮ハンドル（通常ハンドルよりやや大きく・ミント塗り） */
.editor-handle.crop-corner {
  width: 24px;
  height: 24px;
  background: var(--mint);
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--mint-dark);
  z-index: 3;
}
/* 調整中バッジ（写真枠の直上・ink地に白文字の丸ピル。押せない=影なし） */
.editor-crop-badge {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-weight: 800;
  font-size: 12px;
  color: #fff;
  background: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  pointer-events: none;
  z-index: 4;
}
.editor-crop-badge i { font-size: 12px; color: #fff; }
.editor-crop-badge[hidden] { display: none !important; }

/* ==========================================================================
   印刷（@media print）
   画面 UI を隠し、#print-container のみ表示。
   ========================================================================== */
#print-container { display: none; }

@media print {
  .app { display: none !important; }
  .modal-overlay { display: none !important; }
  .editor-overlay { display: none !important; }
  .faq-section { display: none !important; }
  .changelog-section { display: none !important; }
  .site-footer { display: none !important; }
  #pbm-header-bar { display: none !important; }

  #print-container { display: block; }
  #print-container .print-page {
    display: block;
    page-break-after: always;
    break-after: page;
  }
  #print-container .print-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }
  #print-container img {
    display: block;
    width: 100%;
    height: auto;
  }
  html, body {
    background: #fff;
    margin: 0;
    padding: 0;
  }
}
