html {
  font-size: 14px;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: sans-serif;
}

/* ===== 全体 ===== */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ===== 上部 ===== */
#header {
  height: 50px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid #ccc;
  background: #fff;
}

.header-left {
  display: flex;
  gap: 20px;
  align-items: center;
}

.selectGroup {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: #666;
}

.selectGroup label {
  margin-bottom: 4px;
  font-weight: 500;
}

.selectGroup select {
  font-size: 13px;
}


#header select,
#header button {
  margin-right: 10px;
}

#header select,
#header button,
#sidePanel button,
#sidePanel select {
  font-size: 13px;
  padding: 4px 8px;
}

/* ===== メイン ===== */
#main {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;   /* ★ 重要 */
}

/* ===== キャンバスラッパー ===== */
#canvasWrapper {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;   /* ★ 重要 */
}

/* ===== キャンバスエリア ===== */
#canvasArea {
  flex: 1;
  display: flex;
  padding-top: 20px;
  justify-content: center;
  align-items: center;
  background: #e5e5e5;
  min-height: 0;   /* ★ 重要 */
}


.spreadWrap {
  display: flex;
  margin-top:7px;
  align-items: center;
  gap: 0;
}

/* ===============================
   見開き全体ラッパー
=============================== */

.spreadOuter {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 左右外側ナビ */

.spreadSideBtn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: 0.2s;
}

.spreadSideBtn:hover {
  background: rgba(0,0,0,0.7);
}

.leftSideBtn {
  left: -60px;
}

.rightSideBtn {
  right: -60px;
}

/* ページ表示 */

#spreadPageInfo {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  color: #444;
}

#leftCanvas,
#rightCanvas {
  background: #fff;
  box-shadow: 0 0 10px rgba(0,0,0,0.15);
}

.canvasContainer {
  position: relative;
  display: flex;
}

.spreadNavBtn {
  position: absolute;
  bottom: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.4);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: 0.2s;
}

.spreadNavBtn:hover {
  background: rgba(0,0,0,0.7);
}

.prevBtn {
  left: 14px;
}

.nextBtn {
  right: 14px;
}


#spine {
  align-self: stretch;
  width: 20px;
  background: #d0d0d0;
}

/* ===== ガイド説明ボックス ===== */
#guideInfoBox {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 9999;
  background: rgba(255,255,255,0.9);
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 10px;        /* ★ さらに小さく */
  font-weight: 400;
  line-height: 1.3;
  color: #555;
  pointer-events: none;
}

#guideInfoBox .redLine,
#guideInfoBox .greenLine {
  display: inline-block;
  width: 14px;
  height: 2px;
  margin-right: 5px;
  vertical-align: middle;
}

#guideInfoBox .redLine {
  background: #ff0000;
}

#guideInfoBox .greenLine {
  background: #00aa55;
}

/* ===== 右パネル ===== */
#sidePanel {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #ccc;
  background: #fafafa;
}

#sidePanel {
  font-size: 13px;
}

.panelSection {
  padding: 15px;
  border-bottom: 1px solid #ddd;
}

#objectEditor {
  flex: 1;
  overflow-y: auto;
  min-height: 0;  /* ★ 重要 */
}

.fixedBottom {
  border-top: 1px solid #ccc;
}

/* ===== サムネイル ===== */
#footer {
  height: 100px;
  flex-shrink: 0;
  border-top: 1px solid #ccc;
  background: #fff;
  overflow-x: auto;
  white-space: nowrap;
  padding: 3px;
}

/* ===== 表示制御 ===== */
.hidden {
  display: none;
}

/* =========================================================
   フォント
========================================================= */
@font-face{
  font-family:'はんなり明朝';
  src:url('../fonts/HannariMincho-Regular.otf') format('truetype');
  font-display:swap;
}
@font-face{
  font-family:'玉ねぎ楷書';
  src:url('../fonts/tamanegikaisyo.ttf') format('truetype');
  font-display:swap;
}
@font-face{
  font-family:'青柳隷書';
  src:url('../fonts/aoyagireisyosimo_ttf_2_01.ttf') format('truetype');
  font-display:swap;
}
@font-face{
  font-family:'しょかきさらり行体';
  src:url('../fonts/syokakisararigyosyo.ttf') format('truetype');
  font-display:swap;
}
@font-face{
  font-family:'kawaii手書き文字';
  src:url('../fonts/KTEGAKI.ttf') format('truetype');
  font-display:swap;
}
@font-face{
  font-family:"英椎行書";
  src:url("../fonts/acgyosyo.ttf") format("truetype");
  font-display:block;
}
@font-face{
  font-family:"Potta One";
  src:url("../fonts/PottaOne-Regular.woff2") format("woff2");
  font-display:block;
}

/* 初期化前は非表示 */
.canvas-hidden {
  visibility: hidden;
}

#editorLoading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: #f2f2f2;
  z-index: 10;
}

.pageLabel {
  margin-top: 10px;
  padding-top: 5px;
  font-size: 13px;
  margin-bottom: 7px
  color: #333;
}

.pageDisabled {
  opacity: 0.35;
  pointer-events: none;
}

#pageNotice {
  color: #8e0e0e;
  font-size: 12px;
  margin-left: 10px;
  vertical-align: middle;
}

#leftPageLabel,
#rightPageLabel {
  margin-top: 3px;      /* ← 上を縮める（小さくする） */
  margin-bottom: 10px;  /* ← 下を広げる（大きくする） */
  line-height: 1.2;     /* ← 文字の内部余白も締める */
}

.canvasActive {
  box-shadow: 0 0 0 3px #4a90e2;
  border-radius: 4px;
}

.canvasInactive {
  box-shadow: none;
}

.hidden {
  display: none;
}

.canvas-container.album-selected {
  outline: 4px solid #4A90E2;
  outline-offset: 0;
}

/* ===== ヘッダー高さを圧縮 ===== */
#header,
.editor-header {
  padding: 6px 12px !important;
  min-height: auto !important;
}

#header button,
.editor-header button {
  padding: 3px 10px !important;
  font-size: 12px !important;
}

/* ===== フッター高さを圧縮 ===== */
#thumbnailArea,
.editor-footer {
  padding: 6px 10px !important;
  min-height: 40px !important;
}

#thumbnailArea p,
.editor-footer p {
  margin: 0 !important;
  font-size: 14px;
}

/* =====================================
   サムネイル（見開き表示）
===================================== */

#thumbnailArea {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  align-items: flex-start;
}

.thumbSpread {
  width: 80px;              /* 小さめ */
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.thumbImageWrap {
  width: 100%;
  aspect-ratio: 2 / 1;      /* 見開き比率 */
  background: #ddd;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumbSpread.active .thumbImageWrap {
  border: 2px solid #d33;
}

.thumbSpread img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbPages {
  display: flex;
  gap: 2px;
}

.thumbPages canvas {
  width: 50px;
  height: 70px;
}

.thumbLabel {
  font-size: 10px;
  margin-top: 3px;
  line-height: 1;
  text-align: center;
  color: #333;
}

/* ===== キャンバス上下に余白を確保 ===== */
#spreadArea,
.canvas-wrapper,
.album-canvas-wrapper {
  padding-top: 10px;
  padding-bottom: 10px;
}

/* ===== ヘッダー高さを圧縮 ===== */
#header {
  padding-top: 2px !important;
  padding-bottom: 2px !important;
  line-height: 1 !important;
}

#header .selectGroup {
  margin-bottom: 0 !important;
}

#header label {
  font-size: 14px !important;
  margin-bottom: 1px !important;
}

#header select {
  padding: 2px 6px !important;
  height: 20px !important;
}

#header button {
  padding: 5px 10px !important;
  height: 30px !important;
  font-size: 14px !important;
}

.spreadWrap {
  margin-bottom: 15px !important;
}

#blurEdgeBtn.hidden {
  display: none;
}

#bgColorPicker {
  height: 32px;          /* ボタンと同じ高さ */
  padding: 0;
  box-sizing: border-box;
}

/* =========================================================
   フォント
========================================================= */
@font-face{
  font-family:'はんなり明朝';
  src:url('../fonts/HannariMincho-Regular.otf') format('truetype');
  font-display:swap;
}
@font-face{
  font-family:'玉ねぎ楷書';
  src:url('../fonts/tamanegikaisyo.ttf') format('truetype');
  font-display:swap;
}
@font-face{
  font-family:'青柳隷書';
  src:url('../fonts/aoyagireisyosimo_ttf_2_01.ttf') format('truetype');
  font-display:swap;
}
@font-face{
  font-family:'しょかきさらり行体';
  src:url('../fonts/syokakisararigyosyo.ttf') format('truetype');
  font-display:swap;
}
@font-face{
  font-family:'kawaii手書き文字';
  src:url('../fonts/KTEGAKI.ttf') format('truetype');
  font-display:swap;
}
@font-face {
  font-family: "英椎行書";
  src: url("../fonts/acgyosyo.ttf") format("truetype");
  font-display: block;
}
@font-face {
  font-family: "Potta One";
  src: url("../fonts/PottaOne-Regular.woff2") format("woff2");
  font-display: block;
}

#textEditPanel input[type="color"] {
  vertical-align: middle;
  height: 32px;        /* ボタンと同じ高さに合わせる */
  padding: 0;
  margin: 0 6px;
  box-sizing: border-box;
}

/* 画像追加・テキスト追加・背景色の横並びを揃える */
.topControlRow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.imageButtonRow {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ------------------------------
   テキスト編集 横並び
------------------------------ */

.textControlRow {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 全要素の余白リセット */
.textControlRow * {
  margin: 0;
}

/* フォント選択 */
.textControlRow select {
  width: 140px;   /* 150 → 少し縮める */
  height: 32px;
  padding: 0 6px;
}

/* カラーピッカー */
.textControlRow input[type="color"] {
  width: 36px;
  height: 32px;
  padding: 0;
}

/* ボタン */
.textControlRow button {
  height: 32px;
  padding: 0 12px;
}

#thumbContainer {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 3px;
  background: #f3f3f3;
}

.spreadThumb {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.thumbItem {
  border: 1px solid #999;
  background: white;
}

/* サムネ本体 */
.spreadThumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* ===== 基本構造 ===== */
.spreadThumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

/* サムネ2枚を包む */
.thumbPages {
  display: flex;
  gap: 2px;
  transition: outline 0.15s ease;
}

.spreadThumb {
  box-shadow: 0 0 0 0 transparent;
  border-radius: 6px;
  padding: 4px;
}

.thumbItem.active{
  outline:2px solid #4A90E2;
  outline-offset:-2px;
}

.thumbDisabled{
  cursor: default;
  pointer-events: none;
}

.spreadThumb.dragging{
  opacity:0.4;
}

.orderStartArea{
  text-align:center;
  margin:20px 0 40px;
}

.orderStartBtn{
  font-size:20px;
  padding:14px 40px;
  background:#ff6b00;
  color:#fff;
  border:none;
  border-radius:6px;
  cursor:pointer;
}

.orderStartBtn:hover{
  background:#e65c00;
}

/* =================================
   注文ポップアップ
================================= */

.orderStartArea{
  text-align:center;
  margin-top:20px;
}

.orderStartBtn{
  font-size:20px;
  padding:12px 30px;
  background:#ff6600;
  color:#fff;
  border:none;
  border-radius:6px;
  cursor:pointer;
}

.orderStartBtn:hover{
  background:#e65c00;
}

/* 背景 */
#orderArea{
  position:fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background:rgba(0,0,0,0.55);

  display:none;          /* 初期非表示 */

  justify-content:center;
  align-items:flex-start;
  padding-top:20px;

  z-index:9999;
}

/* フォーム */
#orderArea form{
  width:420px;
  max-height:90vh;
  overflow-y:auto;
  background:#fff;
  padding:25px;
  border-radius:8px;
  box-shadow:0 10px 30px rgba(0,0,0,0.3);
}

#orderArea label{
  display:block;
  margin-top:12px;
}

#orderArea input,
#orderArea textarea,
#orderArea select{
  width:100%;
  padding:3px;
  margin-top:4px;
  box-sizing:border-box;
}

#submitBtn{
  margin-top:16px;
  width:100%;
  padding:10px;
  background:#ff6600;
  color:#fff;
  border:none;
  border-radius:5px;
  font-size:16px;
  cursor:pointer;
}


.closeOrderBtn{
  margin-top:12px;
  width:100%;
  padding:10px;
  background:#888;
  color:#fff;
  border:none;
  border-radius:5px;
  font-size:16px;
  cursor:pointer;
}

.closeOrderBtn:hover{
  background:#666;
}

#orderLoading{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.45);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:9999;
}

.orderLoadingBox{
  background:#fff;
  padding:40px;
  border-radius:10px;
  text-align:center;
  width:320px;
}

.orderLoadingText{
  font-size:16px;
  margin-top:15px;
}

.orderSpinner{
  width:40px;
  height:40px;
  border:4px solid #ddd;
  border-top:4px solid #ff6b00;
  border-radius:50%;
  animation:spin 1s linear infinite;
  margin:auto;
}

@keyframes spin{
  0%{transform:rotate(0deg);}
  100%{transform:rotate(360deg);}
}

#spineCanvas{
  margin: 0 !important;
  padding: 0 !important;
  display:block;
}

.pageCanvasWrap{
  position:relative;
  z-index:2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#spine{
  position:relative;
  flex:0 0 40px;   /* ←これが本体 */
  width:20px;
  background:#fffab5;
}

#leftCanvas,
#rightCanvas{
  position:relative;
  z-index:1;
}

.pageActive{
  outline:3px solid #4A90E2;
}

.canvas-container .lower-canvas{
  z-index:0 !important;
}

.canvas-container .upper-canvas{
  z-index:1 !important;
  pointer-events:auto;
}

/* ===============================
   注文画面 全体
=============================== */
#orderModal {
  position: fixed;
  inset: 0;
  display: block;
  padding: 0;
  margin: 0;
  overflow: visible;
  z-index: 9999;
  background: rgba(0,0,0,0.25);
}

/* ===============================
   注文ウィンドウ本体
   上下を画面いっぱい近くまで使う
=============================== */
#orderArea {
  position: absolute;

  top: 0;
  bottom: 0;

  left: 50%;
  transform: translateX(-50%);

  width: 95%;
  max-width: 560px;

  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

/* ===============================
   フォーム本体
=============================== */
#orderForm {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 6px 8px !important;
  box-sizing: border-box;
}

/* ===============================
   見出し・説明
=============================== */
#orderForm h2 {
  margin: 0 0 4px 0 !important;
  padding: 0;
  font-size: 16px;
  line-height: 1.1;
}

#orderForm .note {
  margin: 0 0 6px 0 !important;
  font-size: 12px;
  line-height: 1.2;
}

/* ===============================
   ラベル
=============================== */
#orderForm label {
  margin: 4px 0 2px 0 !important;
  font-size: 12px;
}

#orderForm input,
#orderForm select {
  height: 30px;
  margin: 0 0 4px 0 !important;
  font-size: 13px;
  padding: 2px 6px;
}

/* ===============================
   要望欄
   ← ここを明示的に大きくする
=============================== */
#comment {
  height: 60px !important;
  min-height: 60px !important;
  margin: 0 0 6px 0 !important;
}
/* ===============================
   ボタン
=============================== */
#submitBtn {
  display: block;
  width: 100%;
  height: 36px;
  margin: 0 0 8px 0 !important;
  font-size: 18px;
  box-sizing: border-box;
}

#closeOrderBtn {
  display: block;
  width: 100%;
  height: 36px;
  margin: 0 !important;
  font-size: 16px;
  box-sizing: border-box;
}

#autozip {
  display: none !important;
}

.spineCanvasWrap {
  margin: 0 !important;
  padding: 0 !important;
}

/* 入力エリア全体を詰める */
#orderArea input,
#orderArea textarea,
#orderArea select {
  padding: 3px 5px;   /* ← 元より小さく */
  margin-bottom: 3px; /* ← 間隔も詰める */
  font-size: 12px;
}

#orderArea button {
  padding: 4px 4px;   /* ← 小さく */
  font-size: 14px;
}

#orderArea .order-buttons {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-top: 8px;
  padding-top: 16px;
}

.lower-canvas:focus,
.upper-canvas:focus,
canvas:focus {
  outline: none !important;
}
