/* =========================================
   PWA内蔵カメラ モーダル
   - 縦持ち固定: ファインダー上、コントロール下
   - ファインダー内に黒板が90°回転して表示される
   - 切り出し範囲(4:3横長)はファインダー中央に橙枠で表示
   ========================================= */

.camera-modal {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 1000;
  display: none;
  flex-direction: column;
  overscroll-behavior: contain;
  touch-action: none;
}
.camera-modal.open {
  display: flex;
}

.camera-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #000;
  min-height: 0;
}

.camera-stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.camera-stage canvas {
  position: absolute;
  pointer-events: none;
}

.camera-status {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 14px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 5;
}
.camera-status:empty { display: none; }

.cam-handle {
  position: absolute;
  width: 22px;
  height: 22px;
  background: #c8521a;
  border: 2.5px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
  cursor: nwse-resize;
  touch-action: none;
}
.cam-handle.handle-ne, .cam-handle.handle-sw { cursor: nesw-resize; }

.camera-controls {
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px calc(0px + env(safe-area-inset-bottom)) 32px;
  background: #000;
  flex-shrink: 0;
}

.cam-btn {
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.cam-btn-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
  display: grid;
  place-items: center;
}
.cam-btn-close:active { background: rgba(255, 255, 255, 0.3); }

.cam-btn-shutter {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid rgba(255, 255, 255, 0.6);
  position: relative;
  transition: transform 0.1s;
}
.cam-btn-shutter::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #000;
}
.cam-btn-shutter:active { transform: scale(0.92); }

.cam-btn-switch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.cam-btn-switch:active { background: rgba(255, 255, 255, 0.3); }
