@charset "utf-8";

/* カスタムプロパティ (CSS変数) */
:root {
  --color-bg-dark: #1a1a1a;
  --color-control-dark: #2a2a2a;
  --color-accent: #ffcc00;
  --color-red: #ff3b30;
  --color-white: #ffffff;
  --shutter-size: 72px;
  --control-panel-height: 200px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  background: var(--color-bg-dark);
  color: var(--color-white);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: hidden;
}

/* カメラ映像ラッパー */
#cameraWrap {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  /* スワイプ機能を削除したため、touch-actionは不要 */
  overflow: hidden;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.3s ease;
}

canvas#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* 画面上部の情報表示 */
#topInfo {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  font-size: 14px;
  z-index: 20;
  opacity: 1;
}

.rec-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-red);
  margin-right: 8px;
  display: none;
}

#topInfo.is-recording .rec-indicator {
  display: block;
  animation: pulse 1s infinite alternate;
}

/* タイマー表示 */
#timerDisplay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 100px;
  font-weight: bold;
  color: var(--color-red);
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
  z-index: 30;
  opacity: 0;
  transition: opacity 0.3s;
}

#timerDisplay.active {
  opacity: 1;
}

@keyframes pulse {
  from {
    opacity: 1;
  }

  to {
    opacity: 0.5;
  }
}

/* 下部操作パネル */
#bottomControls {
  flex-basis: var(--control-panel-height);
  min-height: var(--control-panel-height);
  background: var(--color-control-dark);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0 16px;
  box-sizing: border-box;
  position: relative;
}

/* フィルター選択 */
#filterRow {
  display: flex;
  gap: 16px;
  overflow-x: scroll;
  padding: 0 16px;
  width: 100%;
  justify-content: flex-start;
  -ms-overflow-style: none;
  scrollbar-width: none;
  margin-top: 8px;
}

#filterRow::-webkit-scrollbar {
  display: none;
}

/* フィルターボタン（選択肢） */
.filter-option {
  min-width: 50px;
  text-align: center;
  font-size: 12px;
  padding: 4px 0;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.filter-option.active {
  opacity: 1;
  color: var(--color-accent);
  font-weight: bold;
  border-bottom: 2px solid var(--color-accent);
}

/* モードインジケーター (写真/ビデオ) */
#modeIndicator {
  display: flex;
  gap: 30px;
  font-size: 16px;
  font-weight: 500;
  padding-top: 10px;
}

.mode-item {
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s;
  cursor: pointer;
}

.mode-item.active {
  opacity: 1;
  font-weight: bold;
  transform: scale(1.1);
  color: var(--color-white);
  border-bottom: 2px solid var(--color-white);
  /* モード切替の強調 */
  padding-bottom: 2px;
}

.mode-item:active {
  opacity: 0.8;
}

/* シャッター/ユーティリティボタン */
#shutterRow {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  padding: 0 5%;
  margin-bottom: 8px;
}

/* ユーティリティボタン */
.utility-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-white);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s;
}

.utility-btn:active {
  background: rgba(255, 255, 255, 0.3);
}

/* タイマー選択ドロップダウン */
#timerSelect {
  appearance: none;
  background: none;
  border: none;
  color: var(--color-white);
  font-size: 14px;
  padding: 0;
  text-align: center;
  cursor: pointer;
}

#timerSelect option {
  color: var(--color-bg-dark);
}

/* --- シャッターボタンのデザイン調整 --- */
#shutterBtn {
  width: var(--shutter-size);
  height: var(--shutter-size);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.2s, background 0.2s;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

#shutterBtn:active {
  transform: scale(0.9);
}

/* 1. 写真モード (白丸のみ) */
#shutterBtn.camera-mode {
  border: 4px solid var(--color-white);
  background: var(--color-white);
}

/* 2. ビデオモード準備中 (白枠の中に赤丸) */
#shutterBtn.video-mode {
  border: 4px solid var(--color-white);
  background: transparent;
}

#shutterBtn.video-mode::before {
  content: "";
  position: absolute;
  width: 60%;
  height: 60%;
  border-radius: 50%;
  background: var(--color-red);
  transition: opacity 0.3s;
}

/* 3. 録画開始後 (赤枠の四角) */
#shutterBtn.recording {
  border-color: var(--color-red);
  background: transparent !important;
}

#shutterBtn.recording::after {
  content: "";
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 8px;
  background: var(--color-red);
}

/* コピーライト表示 */
#copyright {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: rgba(255, 255, 255, 0.4);
  z-index: 5;
  pointer-events: none;
  text-align: center;
}
