/* ==========================================================================
   メインレイアウト
   ========================================================================== */

body {
  background-image: url("../img/background.png");
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-position: center;
  color: var(--dark);
}

.background {
  position: fixed;
  z-index: -1;
  width: 100vw;
  height: var(--full-height);
}

.main {
  width: 100vw;
  height: var(--full-height);
  padding: 0 8vw;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ==========================================================================
   スタートポップアップ (設置場所選択)
   ========================================================================== */

.popup {
  position: fixed;
  z-index: 1000;
  width: 100vw;
  height: var(--full-height);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2vw;
}

.popup-label {
  font-size: 1.8vw;
  color: var(--dark);
  text-align: center;
  margin-bottom: 1vw;
}

.popup-btn-group {
  display: flex;
  gap: 1.5vw;
}

.popup-location-btn {
  font-size: 1.8vw;
  padding: 1.2vw 3vw;
  border: none;
  background: var(--blue);
  border-radius: 100vw;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.popup-location-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.popup-location-btn:active {
  transform: scale(0.97);
}

/* ==========================================================================
   左上ロゴ
   ========================================================================== */

.logo {
  position: fixed;
  border-radius: 100%;
  width: 23vw;
  top: -6vw;
  left: -6vw;
  aspect-ratio: 24 / 24 auto;
  background-color: var(--main-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.logo-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-top: 4.5vw;
  padding-left: 2.5vw;
}

.logo-inner p {
  font-size: 1.8vw;
  line-height: 200%;
  color: var(--light);
}

.logo-inner p span {
  font-size: 2vw;
  color: var(--red);
}

.logo-img {
  width: 10vw;
}

/* ==========================================================================
   右上 時計・気温
   ========================================================================== */

.clock-temp {
  position: fixed;
  z-index: 999;
  top: 0;
  right: 0;
}

.temp {
  margin-top: 4vw;
  border-radius: 1vw 0 0 1vw;
  padding: 1vw;
  width: 6vw;
  display: flex;
  justify-content: center;
  align-items: center;
}

.temp span {
  font-family: "smart-font-ui";
  font-size: 2vw;
}

.clock {
  margin-top: 1.5vw;
  border-radius: 1vw 0 0 1vw;
  padding: 1vw;
  width: 6vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.clock span {
  font-family: "smart-font-ui";
  font-size: 3vw;
}

/* ==========================================================================
   お知らせティッカー
   ========================================================================== */

.info-s {
  width: 100%;
  height: calc(var(--vh) * 20);
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.info-s .info {
  width: 100%;
  height: calc(var(--vh) * 12);
  border-radius: calc(var(--vh) * 12);
}

#announcement {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-top: 1vw;
}

.ticker-text {
  position: absolute;
  left: 0;
  white-space: nowrap;
  font-size: 2.5vw;
  color: var(--dark);
  will-change: transform;
}

.ticker-paused .ticker-text {
  opacity: 0.3;
}

/* ==========================================================================
   メインコンテンツエリア + サイドパネル
   ========================================================================== */

.main-sub-s {
  width: 100%;
  flex: 1;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-height: 0;
}

.sub-s {
  flex: 1.4;
  height: 100%;
  display: flex;
  align-items: center;
  padding-right: 2vw;
}

.main-s {
  flex: 4.7;
  height: 100%;
  display: flex;
  align-items: center;
}

.main-box {
  padding: 0;
  width: 95%;
  aspect-ratio: 16 / 9;
  border-radius: 1vw;
  overflow: hidden;
  position: relative;
}

.mute-overlay {
  position: absolute;
  top: 1vw;
  right: 1vw;
  background-color: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 0.5vw 1vw;
  border-radius: 0.5vw;
  font-size: 1.2vw;
  z-index: 10;
  pointer-events: none;
}

#canvas {
  width: 100%;
  height: 100%;
  background-color: transparent;
  display: block;
}

#video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

/* ==========================================================================
   混雑状況パネル
   ========================================================================== */

.crowd-status-box {
  padding: 0 0.6vw 0.6vw 0.6vw;
  display: flex;
  flex-direction: column;
  border-radius: 1vw;
  width: 90%;
  margin-top: 3vw;
}

.crowd-status-set {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0.5vw 0.6vw 0 0.6vw;
}

/* 5段階画像 ⇔ カメラ映像 を重ねて表示するラッパー */
.crowd-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0.3vw;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
}

/* 各レイヤー (画像 / カメラ) を重ね、is-active のものだけを表示 */
.crowd-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0.3vw;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.crowd-layer.is-active {
  opacity: 1;
}

/* カメラ映像読み込み前/失敗時に空表示にならないようフォールバック背景 */
.crowd-layer-camera {
  background: #1f2937;
}

/* 現在どちらを表示しているか示すバッジ (上部・中央揃え / 小さめサイズ) */
.crowd-media-badge {
  position: absolute;
  top: 0.3vw;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 0.2vw 1vw;
  font-size: 0.62vw;
  line-height: 1.35;
  font-weight: 700;
  color: #fff;
  border-radius: 0.5vw;
  letter-spacing: 0.1em;
  white-space: nowrap;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  box-shadow: 0 0.1vw 0.4vw rgba(0, 0, 0, 0.3);
}

.crowd-badge-image {
  background: rgba(37, 99, 235, 0.85); /* 青系: 混雑状況 */
}

.crowd-badge-camera {
  background: rgba(220, 38, 38, 0.85); /* 赤系: ライブカメラ */
}

.crowd-badge-camera::before {
  content: "";
  display: inline-block;
  width: 0.4vw;
  height: 0.4vw;
  margin-right: 0.3vw;
  border-radius: 50%;
  background: #fff;
  animation: crowd-live-blink 1.4s ease-in-out infinite;
  vertical-align: middle;
}

@keyframes crowd-live-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .crowd-layer { transition: none; }
  .crowd-badge-camera::before { animation: none; }
}

.crowd-status-set figcaption {
  font-size: 1.2vw;
  line-height: 1.3;
}

.crowd-status-set p {
  margin-top: 0.5rem;
  font-size: 2vw;
  text-align: center;
}

/* ==========================================================================
   落とし物・忘れ物フッターバナー
   ========================================================================== */

.lostitem-footer {
  width: 90%;
  height: calc(var(--vh) * 13);
  display: flex;
  gap: 1vw;
  align-items: center;
  flex-shrink: 0;
  padding-bottom: 0.5vh;
}

.lostitem-slider {
  flex: 1;
  height: 100%;
  overflow: hidden;
  position: relative;
  border-radius: 1vw;
}

.lostitem-track {
  display: flex;
  gap: 0.8vw;
  padding: 0.5vw;
  height: 100%;
  will-change: transform;
}

.lostitem-card {
  flex-shrink: 0;
  width: 10vw;
  height: 100%;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 0.5vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.lostitem-card-img {
  flex: 1;
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2vw;
  min-height: 0;
  overflow: hidden;
}

.lostitem-card-title {
  padding: 0.2vw 0.4vw;
  font-size: 0.7vw;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(0, 0, 0, 0.25);
  color: var(--dark);
}

.lostitem-no-data {
  width: auto;
  min-width: 20vw;
  justify-content: center;
  align-items: center;
}

.lostitem-no-data .lostitem-card-img {
  background: transparent;
  white-space: nowrap;
}

.lostitem-qr {
  width: calc(var(--vh) * 12);
  height: 100%;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 1vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2vw;
  flex-shrink: 0;
}

.lostitem-qr-img {
  width: calc(var(--vh) * 8);
  height: calc(var(--vh) * 8);
  object-fit: contain;
}

.qr-label {
  font-size: 0.6vw;
  color: #333;
  text-align: center;
  font-weight: 600;
}

/* ==========================================================================
   フッター注記 (デフォルト非表示)
   ========================================================================== */

.note {
  display: none;
}

/* ==========================================================================
   WebSocket 接続状態インジケータ
   ========================================================================== */

.ws-indicator {
  position: fixed;
  bottom: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  z-index: 1;
  pointer-events: none;
  opacity: 0.7;
  transition: background 0.3s;
}

.ws-indicator.ws-connected {
  background: #10b981;
}

.ws-indicator.ws-connecting {
  background: #f59e0b;
  animation: ws-pulse 1.2s ease-in-out infinite;
}

.ws-indicator.ws-error {
  background: #ef4444;
  animation: ws-blink 0.6s ease-in-out infinite;
}

@keyframes ws-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.3; }
}

@keyframes ws-blink {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.1; }
}
