/* ============ 撮影画面 ============ */
/* 撮影画面はヘッダーをカメラ風の“透明オーバーレイ”にして高さを食わせない（shoot.css は撮影画面だけ読込） */
.app-header {
  padding: 8px 14px;
  font-size: 15px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 36;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));
  pointer-events: none; /* 帯の地はタップを通す＝カメラ/黒板操作の邪魔をしない */
}
.app-header a { pointer-events: auto; } /* ←/編集ボタンだけ反応（タイトルや地は透過） */
/* 撮影エリアを囲む黒帯フレーム。中にステージを「普通の写真の縦横比」で中央寄せ＝超ワイドにしない */
.stage-frame {
  width: 100%;
  height: 66vh;
  height: calc(100dvh - 210px); /* 縦向き：操作部＋ヒントぶんだけ引く（幅基準なので過大にしない） */
  min-height: 360px;
  background: #000; /* 余白＝カメラアプリ風の黒帯 */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.shoot-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4; /* 縦向き＝普通の写真（縦長）。横向きは下のメディアクエリで4/3に */
  max-width: 100%;
  max-height: 100%;
  background: #23272b;
  overflow: hidden;
  touch-action: none;
}
#cam {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #23272b;
  transform-origin: center center; /* デジタルズームは中央基準で拡大 */
}
#bgImg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #23272b;
  display: none;
}
.pick-photo-btn {
  background: #0f8a58;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 28px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.shoot-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  color: #cfd2d4;
  font-size: 14px;
  white-space: pre-line;
  z-index: 30; /* 黒板(0)・取っ手(21/22)より前面に＝メッセージのボタンを必ず押せる */
}
/* 写真取り込みモードで、まだ写真を選んでいない間は黒板と取っ手を隠す＝「写真を選ぶ」を邪魔しない */
#stage.import-pending .shoot-board,
#stage.import-pending .gk-movebar,
#stage.import-pending .gk-h { display: none !important; }
/* 取り込みプロンプトの「写真を選ぶ」は大きめ＝押しやすく */
.shoot-msg .pick-photo-btn { padding: 18px 36px; font-size: 19px; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4); }
.shoot-board {
  position: absolute;
  left: 8%;
  top: 10%;
  width: 64%;
  box-sizing: border-box;
  border-radius: 3px;
  overflow: hidden;
  cursor: grab;
  user-select: none;
}
.shoot-board .gk-val { white-space: nowrap; display: inline-block; outline: none; }
.shoot-board .gk-date { white-space: nowrap; }
/* 撮影画面では中央メモを“比例縮小”させる（編集用の flex:1/min-height:130 を解除）
   ＝小さくしたとき中央だけ巨大化して上の行が潰れる問題を解消 */
.shoot-board .gk-free { flex: none; min-height: 0; }

/* 黒板の取っ手（移動バー＋8方向リサイズ） */
.gk-movebar {
  position: absolute;
  transform: translate(-50%, calc(-100% - 5px));
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #0f8a58;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 14px;
  white-space: nowrap;
  user-select: none;
  z-index: 22;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}
.gk-movebar .gk-move-label {
  padding: 5px 12px;
  cursor: move;
  touch-action: none;
}
.gk-movebar .gk-reset {
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  padding: 5px 11px;
  border-radius: 0 14px 14px 0;
  cursor: pointer;
  touch-action: none;
}
.gk-movebar .gk-reset:active { background: rgba(255, 255, 255, 0.35); }
.gk-h {
  position: absolute;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  background: #ffd24a;
  border: 2px solid #b97f00;
  border-radius: 50%;
  box-sizing: border-box;
  touch-action: none;
  z-index: 21;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.gk-h-n, .gk-h-s { cursor: ns-resize; }
.gk-h-e, .gk-h-w { cursor: ew-resize; }
.gk-h-ne, .gk-h-sw { cursor: nesw-resize; }
.gk-h-nw, .gk-h-se { cursor: nwse-resize; }

/* ズームスライダー（W=引く / T=寄る） */
.zoom-bar {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 80%;
  padding: 7px 16px;
  background: rgba(0, 0, 0, 0.42);
  border-radius: 22px;
  z-index: 30;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.zoom-bar .zl {
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  width: 12px;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.zoom-bar input[type="range"] {
  width: 160px;
  max-width: 52vw;
  accent-color: #ffd24a;
  touch-action: none;
}

.shoot-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  padding: 16px;
  background: #15181b;
}
.shoot-controls .sc-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid #3a3f44;
  background: #23272b;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}
.shoot-controls .shutter {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: #fff;
  border: 5px solid #b9bcc0;
  cursor: pointer;
}
.shoot-controls .shutter:active { transform: scale(0.95); }

.cap-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  z-index: 40;
}
.cap-overlay img {
  max-width: 100%;
  max-height: 66%;
  border: 1px solid #444;
  border-radius: 4px;
}
.cap-overlay .row { display: flex; gap: 12px; }
.cap-overlay button {
  padding: 11px 20px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.cap-overlay .btn-save { background: #1d9e75; color: #fff; }
.cap-overlay .btn-retry { background: #3a3f44; color: #fff; }
.cap-overlay .save-device {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-size: 15px;
  user-select: none;
  cursor: pointer;
}
.cap-overlay .save-device input { width: 20px; height: 20px; accent-color: #1d9e75; }

.shoot-hint {
  text-align: center;
  font-size: 12px;
  color: #888780;
  padding: 8px 14px 0;
}
.shoot-saveinfo {
  text-align: center;
  font-size: 13px;
  color: #cfd2d4;
  background: #15181b;
  padding: 8px 14px 0;
}
.shoot-saveinfo b { color: #ffd24a; font-weight: 600; }

/* 横向き: 操作を右端の縦並びにして、撮影エリアは4:3で中央寄せ（超ワイドにしない＝標準カメラ風） */
@media (orientation: landscape) {
  /* ヘッダーはオーバーレイ・操作は右に固定なので、撮影エリアは画面の高さいっぱい使える */
  /* 右の操作カラム(92px)ぶん余白を入れて中央寄せ＝カメラ領域の中で左右対称に見える */
  .stage-frame {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    justify-content: center;
    padding-right: 92px;
    box-sizing: border-box;
  }
  .shoot-stage {
    width: auto;
    height: 100%;
    aspect-ratio: 3 / 2; /* 横向き＝普通の写真よりやや横長で大きめ（でも超ワイドにはしない） */
    max-width: 100%;
  }
  .shoot-controls {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 92px;
    flex-direction: column;
    gap: 22px;
    padding: 10px;
    background: linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));
    z-index: 35;
  }
  .shoot-controls .shutter { width: 60px; height: 60px; border-width: 4px; }
  .shoot-controls .sc-btn { width: 44px; height: 44px; }
  .shoot-controls #btnSwitch { display: none; } /* 横向きは撮影と編集だけ */
  .shoot-saveinfo, .shoot-hint { display: none; }
}
