﻿/* ===============================
   POPUP（共通デザイン）
   =============================== */

.onetime_popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
body.open_popup .onetime_popup {
  display: flex;
}

.onetime_popup_inner {
  background: #fff;
  max-width: 480px;
  width: 90%;
  border-radius: 12px;
  overflow: hidden;
  text-align: center;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  position: relative;
}

.onetime_popup_title {
  padding: 16px;
  font-weight: bold;
  color: #fff; /* タイトル文字色。背景はJSで inline 適用 */
}

#popup-main-title {
  font-size: clamp(17px, 3.5vw, 22px);
  /*line-height: 1.4;*/
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* × ボタン */
.onetime_popup_title_close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #fff;
  color: #000;
  border-radius: 50%;
  font-weight: bold;
  font-size: 28px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 4px rgba(0,0,0,0.2);
  z-index: 10000;
  line-height: 1;
  text-align: center;
}

/* 画像 */
#popup-image {
  width: 100%;
  height: auto;
  display: block;
}

/* サブテキスト（背景・色はJSの styles で上書き可） */
#popup-subtext {
  padding: 8px;
  color: #fff;
  font-size: 17px;
  font-weight: bold;
}

/* カウントダウンベース */
#popup-countdown {
  padding: 12px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 8px;
  border: 1px solid transparent;
  text-align: center;
  box-shadow:
    0 1px 0 rgba(0,0,0,0.06),
    inset 0 0 0 1px rgba(255,255,255,0.15);
  transition: background 240ms ease, color 160ms ease, text-shadow 160ms ease, border-color 160ms ease;
}

/* ===============================
   ▼ カウントダウン色パターン（3段階）
   =============================== */

/* 黄色（軽め注意） */
#popup-countdown.cd-level-yellow {
  background: linear-gradient(90deg, #FFF7D6, #FFE08A);
  color: #4C3A00;
  border-color: #E9C65A;
  text-shadow: none;
}

/* 橙（要注意） */
#popup-countdown.cd-level-orange {
  background: linear-gradient(90deg, #FFE1CC, #FFB07A);
  color: #3A1E00;
  border-color: #E0934C;
  text-shadow: none;
}

/* 赤（緊急） */
#popup-countdown.cd-level-red {
  background: linear-gradient(90deg, #B00020, #FF5A5A);
  color: #fff;
  border-color: #9A001C;
  text-shadow: 0 1px 1px rgba(0,0,0,.35);
}

/* ===============================
   ▼ “ふわんふわん”アニメーション
   =============================== */

@keyframes countdown-breathe {
  0%   { transform: scale(1);    filter: brightness(1); }
  50%  { transform: scale(1.02); filter: brightness(1.04); }
  100% { transform: scale(1);    filter: brightness(1); }
}

@keyframes countdown-breathe-strong {
  0%   { transform: scale(1);    filter: brightness(1); }
  50%  { transform: scale(1.04); filter: brightness(1.07); }
  100% { transform: scale(1);    filter: brightness(1); }
}

#popup-countdown.pulse {
  animation: countdown-breathe 2.2s ease-in-out infinite;
  will-change: transform, filter;
}
#popup-countdown.pulse-strong {
  animation: countdown-breathe-strong 1.6s ease-in-out infinite;
  will-change: transform, filter;
}

/* ===============================
   ▼ アクセシビリティ（動作抑制）
   =============================== */
@media (prefers-reduced-motion: reduce) {
  #popup-countdown.pulse,
  #popup-countdown.pulse-strong {
    animation: none !important;
  }
}
