/* ===================================================
   Webフォトフレーム 共通スタイルシート
   =================================================== */

body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ① カメラ映像 */
#webcam {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
#webcam.mirror {
  transform: scaleX(-1);
}

/* ② 撮影領域コンテナ（4:3の枠） */
#stage-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
  box-sizing: border-box;
}

/* ③ フォトフレームの外側を白くするマスク（額縁の役割） */
#stage-container::after {
  content: "";
  position: absolute;
  
  /* 画面の長い辺を基準に、上下左右に100%分はみ出させる */
  top: -100vmax;
  left: -100vmax;
  right: -100vmax;
  bottom: -100vmax;
  
  /* 100vmax分の太い白線で、画面外まで確実に塗りつぶす */
  border: 100vmax solid white; 
  box-sizing: border-box;
  z-index: -1; 
}

/* ④ フォトフレーム（画像） */
#photo-frame {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  position: relative;
  z-index: 3; /* 白枠よりも手前にくるように明示 */
  
  /* 🌟 じわっと切り替えるための追加設定 */
  opacity: 1;
  transition: opacity 0.5s ease-in-out;
}

/* ⑤ UIボタン共通 */
.ui-btn {
  position: fixed;
  z-index: 10;
  background: white;
  border: none;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.ui-btn:active {
  transform: scale(0.95);
}

/* 撮影ボタン */
#capture-btn {
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 28px;
  border-radius: 30px;
  font-size: 16px;
  background: #ff4757;
  color: white;
}
#capture-btn:active {
  transform: scale(0.95) translateX(-50%);
}

/* 🔄 カメラ切り替えボタン */
#switch-btn {
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
}

/* ⑥ プレビュー・保存確認画面 */
#preview-container {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 20;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#preview-image {
  max-width: 85%;
  max-height: 65%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.preview-actions {
  margin-top: 30px;
  display: flex;
  gap: 20px;
}
.preview-btn {
  padding: 12px 26px;
  border-radius: 25px;
  border: none;
  font-weight: bold;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#share-btn {
  background: #2ed573;
  color: white;
}
#retry-btn {
  background: #57606f;
  color: white;
}