.capture-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: white;
  z-index: 9999;
  animation: capture-flash-anim 0.3s ease-out;
  pointer-events: none;
}

@keyframes capture-flash-anim {
  from {
    opacity: 0.7;
  }
  to {
    opacity: 0;
  }
}

#capture-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9998;
}

.capture-spinner {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #4a956c;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: capture-spin 1s linear infinite;
}

@keyframes capture-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* kemokemo の葉っぱの緑をアクセントにした、丸くやわらかい撮影UI */
:root {
  --kemo-green: #4a956c;
  --kemo-green-dark: #2f6e4b;
  --kemo-red: #ff5d5d;
  --kemo-glass: rgba(255, 255, 255, 0.22);
  --kemo-glass-border: rgba(255, 255, 255, 0.45);
  --kemo-font: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "BIZ UDGothic", -apple-system, BlinkMacSystemFont, sans-serif;
}

/* 画面下の横一列。撮影ボタンは中央、写真/ビデオ切り替えはその右側の余白の中央に置く */
#capture-controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(24px + env(safe-area-inset-bottom));
  height: 80px;
  z-index: 100;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}

#capture-controls > * {
  pointer-events: auto;
}

#capture-controls .button-row {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  height: 80px;
}

#capture-controls .action-button {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1.5px solid var(--kemo-glass-border);
  padding: 0;
  box-sizing: border-box;
  background-color: var(--kemo-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: 26px;
  background-position: center;
  background-repeat: no-repeat;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: transform 0.15s ease;
}

#capture-controls .action-button:active {
  transform: scale(0.92);
}

/* シャッター: 白いリングの中に丸。写真=白、ビデオ=赤、録画中=赤い角丸の四角 */
#capture-controls #capture-button {
  width: 80px;
  height: 80px;
  border: 4px solid #fff;
  background-color: rgba(255, 255, 255, 0.18);
}

#capture-controls #capture-button::before {
  content: '';
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #fff;
  box-shadow: inset 0 0 0 3px rgba(74, 149, 108, 0.35);
  pointer-events: none;
  transition: width 0.2s ease, height 0.2s ease, border-radius 0.2s ease, background-color 0.2s ease;
}

#capture-controls #capture-button.video-mode::before {
  background-color: var(--kemo-red);
  box-shadow: none;
}

#capture-controls #capture-button.recording::before {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background-color: var(--kemo-red);
  box-shadow: none;
}

#capture-controls #capture-button.recording {
  animation: kemo-recording-pulse 1.4s ease-in-out infinite;
}

@keyframes kemo-recording-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 93, 93, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(255, 93, 93, 0); }
}

#capture-controls #save-video-button {
  width: 68px;
  height: 68px;
  border-color: rgba(255, 255, 255, 0.7);
  background-color: var(--kemo-green);
  background-size: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11'/%3E%3Cpath d='M7 10.5l5 5 5-5'/%3E%3Cpath d='M5 19.5h14'/%3E%3C/svg%3E");
}

/* 削除ボタンは列の外(左)に出し、録画後は保存ボタンが撮影ボタンと同じ中央に来るようにする */
#capture-controls #delete-video-button {
  position: absolute;
  right: calc(100% + 28px);
  top: 11px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 7h15'/%3E%3Cpath d='M9.5 7V5h5v2'/%3E%3Cpath d='M6.5 7l1 12.5h9l1-12.5'/%3E%3Cpath d='M10.3 11v5M13.7 11v5'/%3E%3C/svg%3E");
}

/* 写真/ビデオ切り替え: すりガラスのピルの中で、選択中だけ白く浮かぶ */
.mode-switcher {
  position: absolute;
  /* 撮影ボタンの右端(50% + 40px)と画面右端の中間 */
  left: calc(75% + 20px);
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  background-color: var(--kemo-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1.5px solid var(--kemo-glass-border);
  border-radius: 22px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.mode-option {
  font-family: var(--kemo-font);
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-align: center;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: color 0.2s, background-color 0.2s;
}

.mode-option.active {
  color: var(--kemo-green-dark);
  background-color: #fff;
  text-shadow: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.mode-option.disabled {
  pointer-events: none;
  opacity: 0.5;
}
