/* 2026-10-29 追加：ロゴの配置・全画面表示 */

/* 全画面・ホーム画面から開いたときも、映像を画面いっぱいに */
:fullscreen #video, :fullscreen #canvas,
.is-standalone #video, .is-standalone #canvas {
  width: 100vw !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
}
:fullscreen .webcam { height: 100dvh; }
:fullscreen body, :fullscreen #app { background: #000; }

/* 全画面ボタン（右上） */
.fullscreen-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 20px);
  right: calc(env(safe-area-inset-right) + 14px);
  z-index: 1200;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
}
.fullscreen-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fullscreen-toggle .fs-exit { display: none; }
.fullscreen-toggle.is-on .fs-enter { display: none; }
.fullscreen-toggle.is-on .fs-exit { display: block; }
#cameraTab:not(.active) .fullscreen-toggle { display: none; }
@media (orientation: landscape) and (max-height: 500px) {
  .fullscreen-toggle { top: calc(env(safe-area-inset-top) + 10px); }
}

/* ロゴの操作の案内 */
.logo-placement-hint {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 1300;
  max-width: min(86vw, 360px);
  padding: 12px 18px;
  border-radius: 14px;
  color: #fff;
  background: rgba(0, 0, 0, 0.72);
  font: 600 14px/1.6 "Noto Sans JP", system-ui, sans-serif;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -40%);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.logo-placement-hint.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%);
}

/* iPhone 向け：ホーム画面に追加する案内 */
.a2hs-guide {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: end center;
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px);
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}
.a2hs-guide.is-visible { opacity: 1; visibility: visible; }
.a2hs-guide__card {
  width: min(100%, 380px);
  padding: 22px 22px 18px;
  border-radius: 20px;
  color: #202326;
  background: #fff;
  font: 400 14px/1.7 "Noto Sans JP", system-ui, sans-serif;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.a2hs-guide__title { margin: 0 0 6px; color: #117b9c; font-size: 17px; font-weight: 800; }
.a2hs-guide__text { margin: 0 0 12px; }
.a2hs-guide__steps { margin: 0 0 16px; padding-left: 1.4em; list-style: decimal; }
.a2hs-guide__steps li { margin-bottom: 4px; }
.a2hs-guide__share {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  vertical-align: -5px;
  border-radius: 6px;
  background: #eaf7fc;
}
.a2hs-guide__share svg { width: 15px; height: 15px; fill: none; stroke: #117b9c; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.a2hs-guide__close {
  display: block;
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: #117b9c;
  font: 700 15px/1 "Noto Sans JP", system-ui, sans-serif;
  text-align: center;
  cursor: pointer;
}

/* スマホ・タブレットのブラウザ：回転しても、映像を常に画面いっぱいに表示する
   （元の作りでは、ブラウザで開くと映像が画面の高さの60%になり、回転後に小さな枠になっていた）
   ※ ホーム画面から開いたとき（is-standalone）は、元の回転処理をそのまま使う */
@media (hover: none) and (pointer: coarse) {
  html:not(.is-standalone) #video,
  html:not(.is-standalone) #canvas {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: auto !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    object-fit: cover !important;
  }
  html:not(.is-standalone) .webcam {
    overflow: visible !important;
  }
}

/* 音声選択：選んだものをはっきり見せる */
#soundList .sound-option { position: relative; }
#soundList .sound-option.selected {
  border-color: #ff5f9e !important;
  background-color: rgba(255, 95, 158, 0.18) !important;
  box-shadow: 0 0 0 3px rgba(255, 95, 158, 0.25);
}
#soundList .sound-option.selected::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  background: #ff5f9e;
  font: 800 14px/1 system-ui, sans-serif;
}

/* 下のバー：選択中＋「この掛け声で撮影する」 */
#settingsTab .settings-content { padding-bottom: 120px; }
.sound-select-bar {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  z-index: 1100;
  display: none;
  align-items: center;
  gap: 12px;
  width: min(calc(100vw - 24px), 520px);
  padding: 10px 10px 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #fff;
  background: rgba(20, 20, 24, 0.88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  transform: translateX(-50%);
  font-family: "Noto Sans JP", system-ui, sans-serif;
}
#settingsTab.active .sound-select-bar { display: flex; }
.sound-select-bar__info { display: grid; min-width: 0; flex: 1; line-height: 1.3; }
.sound-select-bar__label { font-size: 11px; opacity: 0.7; }
.sound-select-bar__name { overflow: hidden; font-size: 14px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.sound-select-bar__btn {
  flex: none;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(180deg, #ff8fc0, #f55291);
  font: 800 14px/1 "Noto Sans JP", system-ui, sans-serif;
  cursor: pointer;
}

/* 選んだカードの中の「▶ 再生／■ 停止」 */
#soundList .sound-card-play {
  margin-top: 4px;
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: #ff5f9e;
  font: 800 14px/1 "Noto Sans JP", system-ui, sans-serif;
  cursor: pointer;
}
#soundList .sound-card-play.is-playing {
  color: #ff5f9e;
  background: #fff;
}
#soundList .sound-option.is-playing { animation: scPulse 1.2s ease-in-out infinite; }
@keyframes scPulse { 50% { box-shadow: 0 0 0 7px rgba(255, 95, 158, 0.18); } }
.sound-select-bar.is-playing .sound-select-bar__label { color: #ff8fc0; opacity: 1; font-weight: 700; }
@media (max-width: 380px) {
  .sound-select-bar { gap: 8px; padding-left: 14px; }
  .sound-select-bar__btn { padding: 12px 12px; font-size: 13px; }
}
@media (max-width: 430px) {
  .sound-select-bar { flex-wrap: wrap; border-radius: 22px; padding: 12px; gap: 10px; }
  .sound-select-bar__info { flex-basis: 100%; padding: 0 4px; }
  .sound-select-bar__btn { flex: 1; }
}

/* 見本フレーム（アーティスト／ロゴ）を選んで一緒に撮る */
.sample-frame-overlay { position: absolute; z-index: 90; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.sample-frame-overlay[hidden] { display: none !important; }
.sample-frame-overlay img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.sample-frame-overlay.is-artist img { filter: drop-shadow(0 6px 14px rgba(0,0,0,.28)); }
.sample-frame-overlay.is-grab { cursor: grabbing; outline: 2px dashed rgba(255,255,255,.9); outline-offset: 2px; }
.sample-frame-bar { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 84px); z-index: 999; display: flex; align-items: center; gap: 6px; max-width: calc(100vw - 20px); padding: 6px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; background: rgba(20,22,26,.55); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 6px 24px rgba(0,0,0,.25); transform: translateX(-50%); font-family: "Noto Sans JP", system-ui, sans-serif; }
.sample-frame-bar[hidden] { display: none !important; }
.sample-frame-bar__label { padding: 0 4px 0 8px; color: rgba(255,255,255,.85); font-size: 11px; font-weight: 800; white-space: nowrap; }
.sample-frame-bar button { display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 12px; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; background: rgba(255,255,255,.08); color: #fff; font: 800 12px/1 "Noto Sans JP", system-ui, sans-serif; white-space: nowrap; cursor: pointer; }
.sample-frame-bar button img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; object-position: 50% 12%; background: #fff; }
.sample-frame-bar button img.is-logo { object-fit: contain; padding: 2px; }
.sample-frame-bar button[aria-pressed="true"] { border-color: #f2416f; background: #f2416f; }
.mode-pwa .sample-frame-bar { top: calc(env(safe-area-inset-top) + 72px); }
@media (max-width: 360px) { .sample-frame-bar__label { display: none; } }
