@charset "utf-8";
/* ぱたぱたアニメ館 - フル版 */

/* --- 横揺れ防止とCSSリセット --- */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
  font-family: 'Inter', 'Meiryo', sans-serif;
  background-color: #f7f7f7;
  /* 画面下固定メニューの高さ分、bodyの下部に余白を設定 */
  padding-bottom: 180px; 
}
*, *::before, *::after {
  box-sizing: border-box;
}

/* --- ヘッダーとコンテナ --- */
header { 
  padding: 15px; 
  text-align: center; 
  background: #2c3e50; 
  color: #fff; 
  font-size: 22px; 
  font-weight: bold;
}
.canvas-wrap {
  width: 100%; 
  margin: 0; 
  padding: 10px; 
  background: #f0f0f0;
}       
#canvas { 
  border: 2px solid #3498db; 
  display: block; 
  margin: 10px auto; 
  touch-action: none; 
  cursor: move; 
  max-width: 100%; 
  height: auto; 
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
#imageToCrop { 
  display: none; 
  max-width: 100%; 
  height: auto; 
  margin: 10px auto; 
  border: 2px solid #e74c3c; 
  border-radius: 8px; 
}

/* --- [下部固定コントロールエリア] --- */
.controls-area {
  position: fixed; 
  bottom: 0;
  left: 0;
  width: 100%;
  background: #fff; 
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
  z-index: 1000; 
  height: 140px; 
  max-height: 140px;
  transition: height 0.3s; 
  overflow: hidden; 
  padding-bottom: env(safe-area-inset-bottom);
}
        
/* 横スクロールさせるコンテナ */
#bottomControls {
  display: flex; 
  overflow-x: scroll; 
  flex-wrap: nowrap; 
  padding: 10px 40px; 
  gap: 15px; 
  -webkit-overflow-scrolling: touch; 
  height: 100%; 
  align-items: flex-start;
}

/* スクロール矢印 */
.scroll-arrow {
  position: absolute;
  top: 0;
  width: 35px;
  height: 100%; 
  z-index: 1001; 
  background: rgba(44, 62, 80, 0.85); 
  color: white;
  border: none;
  font-size: 28px;
  cursor: pointer;
  display: none; 
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.3s;
  line-height: 0; 
}
@media (min-width: 768px) {
  .scroll-arrow { display: flex; }
}
.scroll-arrow.left { left: 0; border-radius: 0 5px 5px 0; }
.scroll-arrow.right { right: 0; border-radius: 5px 0 0 5px; }

/* 各コントロール項目 */
.control-item {
  flex-shrink: 0; 
  width: 300px; 
  height: 100%;
  padding: 0 10px;
  border-right: 1px solid #eee; 
  display: flex;
  flex-direction: column; 
  justify-content: flex-start;
}

/* ファイル入力 */
.control-item.file-input {
  width: 300px; 
  padding-top: 5px;
  justify-content: center;
}
.control-item.file-input input[type="file"] {
  display: block;
  margin-top: 5px;
  font-size: 16px;
  height: 50px;
}

/* 注意書き */
.control-item.note-block {
  width: 300px; 
  border-right: none;
  padding-top: 10px;
}
.control-item.note-block .note {
  font-size: 12px;
  white-space: normal;
  border: 1px dashed #e74c3c;
  padding: 5px;
  border-radius: 4px;
  height: auto;
}

/* 通常時のトリミングボタン（1つだけ表示） */
.control-item.trim-block:not(.cropping-active) #toggleCropBtn {
  height: 100px !important; 
  font-size: 22px !important; 
  font-weight: bold;
  margin-bottom: 5px !important;
  padding: 8px !important;
  display: block !important; 
}
/* 通常時は確定・リセットを隠す */
.control-item.trim-block:not(.cropping-active) #doCropBtn,
.control-item.trim-block:not(.cropping-active) #resetCropBtn {
  display: none !important;
}

/* 文字入力エリア */
.control-item.text-input {
  padding-top: 10px; 
  height: 120px; 
}
.control-item.text-input textarea {
  height: 100px; 
  font-size: 16px;
  resize: none;
  margin-bottom: 5px;
}

/* 単独アクションボタン */
.control-item.single-action {
  width: 300px; 
  padding-top: 10px;
}
.control-item.single-action button {
  height: 100px; 
  font-size: 22px; 
  font-weight: bold;
}

/* 共通入力スタイル */
.control-item label {
  font-size: 16px; 
  margin-bottom: 2px;
  font-weight: bold;
  color: #333;
  display: block;
}
.control-item input, 
.control-item select, 
.control-item:not(.single-action):not(.trim-block) button { 
  width: 100%;
  font-size: 18px; 
  padding: 8px;
  height: 40px;
  border-radius: 4px;
  border: 1px solid #ccc;
  margin-bottom: 5px;
}
button { 
  background: #3498db; 
  color: #fff; 
  border: none; 
  cursor: pointer; 
  font-weight: 600;
}

/* --- ⭐️ トリミングモード（cropping-active）時のスタイル修正 --- */

/* エリアの高さを高くし、他を非表示にする */
.controls-area.cropping-active {
  height: 170px !important; 
  max-height: 170px !important;
}
.controls-area.cropping-active .scroll-arrow,
.controls-area.cropping-active .control-item:not(.trim-block) {
  display: none !important; 
}

/* 横並びのレイアウト設定 */
.controls-area.cropping-active #bottomControls {
  overflow: hidden; 
  padding: 10px !important; 
  width: 100%;
  display: flex;
}
.controls-area.cropping-active .control-item.trim-block {
  width: 100% !important; 
  flex-direction: row !important; 
  gap: 1px; 
  border-right: none; 
  padding: 0;
  align-items: center;
}

/* 3つのボタンをすべて表示し、巨大化させる */
.controls-area.cropping-active .control-item.trim-block button#toggleCropBtn,
.controls-area.cropping-active .control-item.trim-block button#doCropBtn,
.controls-area.cropping-active .control-item.trim-block button#resetCropBtn {
  display: block !important;
  visibility: visible !important; 
  flex: 1 !important; /* 3等分 */
  height: 120px !important; /* スマホで押しやすい巨大サイズ */
  margin: 0 !important;
  font-size: 22px !important;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}

/* PC向けの微調整 */
@media (min-width: 768px) {
  .controls-area.cropping-active {
    height: 120px !important;
  }
  .controls-area.cropping-active .control-item.trim-block button {
    height: 80px !important;
  }
}