/* ペルソナ4風 UIテーマ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Trebuchet MS', 'Verdana', sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #ffffff;
    color: #333;
}

/* Header */
header {
    background-color: #fff8a6;
    color: #000;
    padding: 0.8rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    font-size: 1.4rem;
    font-weight: bold;
    border-bottom: 4px solid #333;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

#gear {
    position: absolute;
    right: 1rem;
    cursor: pointer;
    font-size: 1.4rem;
}

/* Layout */
#container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#sidebar, #facility {
    width: 400px;
    background: #fff;
    padding: 1rem;
    overflow-y: auto;
    height: 100%;
}

#main {
    flex: 1;
    text-align: center;
    padding: 2rem;
    overflow-y: auto;
    height: 100%;
}

/* Buttons */
button {
    background: #fff8a6;
    border: 2px solid #333;
    color: #000;
    font-size: 16px;
    padding: 10px 18px;
    border-radius: 8px;
    margin: 6px;
    transition: all 0.3s ease-in-out;
  cursor: pointer;   /* ← ここを追加 */
}

button:hover {
    background-color: #ffee8d;
    color: #000;
    box-shadow: 0 0 6px #f0c94d;
}

button.small {
    padding: 0.25rem 0.5rem;
    margin-top: 0.4rem;
}

/* Sidebar */
#sidebar button {
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
}

/* Facilities */
.facility-item {
    border: 1px solid #ccc;
    padding: 0.5rem;
    margin-bottom: 1rem;
}

.facility-item button {
    width: 100%;
    margin-top: 0.25rem;
}

.facility-buttons {
  display: flex;
  gap: 4px;         /* ボタン間の余白 */
  margin-top: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;  /* 画面幅が狭い場合に折り返す */
}

.facility-buttons button {
  flex: 1;
  min-width: 90px;  /* 必要に応じて調整 */
  text-align: center;
}

/* Modal */
.hidden {
    display: none !important;
}

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

.modal-content {
    background: #fff;
    padding: 1.5rem;
    border-radius: 10px;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    min-width: 320px;
}

#modalClose {
    position: absolute;
    top: 0.4rem;
    right: 1rem;
    cursor: pointer;
    font-size: 1.4rem;
}

/* Coin Click */
.coin-text {
    font-size: 4rem;
    cursor: pointer;
    transition: transform 0.1s;
}

.coin-text.shrink {
    transform: scale(0.8);
}

#coin-image {
    width: 180px;
    transition: transform 0.1s ease !important;
    -webkit-user-drag: none;
    user-select: none;
    touch-action: none;
      transition: filter 0.5s, box-shadow 0.5s;
}

.shrink img#coin-image {
    transform: scale(0.9);
}

img.coin {
    -webkit-user-drag: none;
}

/* Floating Text */
.floating {
    position: absolute;
    font-family: 'Arial Rounded MT Bold', 'Helvetica Rounded', sans-serif;
    color: whitesmoke;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    font-size: 24px;
    animation: pop-up 1s ease-out forwards;
    pointer-events: none;
    z-index: 10;
}

@keyframes pop-up {
    0% { opacity: 0; transform: translateY(0) scale(0.8); }
    10% { opacity: 1; transform: translateY(-10px) scale(1); }
    100% { opacity: 0; transform: translateY(-60px) scale(1.2); }
}

/* 図鑑モーダル */
.zukan-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1em;
}

.zukan-table td {
  border: 1px solid #ccc;
  padding: 4px;
  font-size: 0.9em;
}

.item-rarity {
  font-weight: bold;
  display: block;
}
.undiscovered {
  color: gray;
}

/* ガチャ結果モーダル */
.gacha-result-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 1em;
}

.gacha-card {
  position: relative; /* ← これが必要 */
    border-radius: 8px;
  padding: 8px;
  margin: 6px;
  text-align: center;
  font-weight: bold;
  color: #fff;
  transition: transform 0.2s ease;
}

.gacha-card .rarity {
  font-weight: bold;
  margin-bottom: 4px;
}
.gacha-card .item-name {
  font-size: 0.9em;
}

.gacha-card .new-mark {
  background: linear-gradient(45deg, #ff416c, #ff4b2b); /* 鮮やかなグラデーション */
  color: white;
  font-weight: bold;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  z-index: 10;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.3); /* 影で浮かせる */
  text-shadow: 0 0 2px black; /* 白文字の読みやすさ強化 */
  pointer-events: none; /* ツールチップなどに干渉しない */
}

.gacha-card .item-count {
  font-size: 0.85em;
  margin-top: 2px;
  color: #555;
}

.gacha-card .★5 { color: gold; }
.gacha-card .★4 { color: orange; }
.gacha-card .★3 { color: royalblue; }
.gacha-card .★2 { color: gray; }
.gacha-card .★1 { color: lightgray; }
/* レア度1（ノーマル） */
.rarity-★1 {
  background-color: #666;
  border: 2px solid #aaa;
}

/* レア度2（レア） */
.rarity-★2 {
  background: linear-gradient(45deg, #3498db, #8e44ad);
  border: 2px solid #5dade2;
  box-shadow: 0 0 8px rgba(52, 152, 219, 0.7);
}

/* レア度3（スーパーレア） */
.rarity-★3 {
  background: linear-gradient(45deg, #f39c12, #e74c3c);
  border: 2px solid #f1c40f;
  box-shadow: 0 0 10px rgba(241, 196, 15, 0.8);
}

/* レア度4（ウルトラレア） */
.rarity-★4 {
  background: linear-gradient(90deg, #e67e22, #e74c3c, #8e44ad);
  border: 3px solid #ff69b4;
  box-shadow: 0 0 15px rgba(255, 105, 180, 0.9);
  animation: pulseRare 1s infinite alternate;
}

.rarity-★5 {
  background: linear-gradient(135deg, red, orange, yellow, green, blue, indigo, violet);
  background-size: 400% 400%;
  border: 3px solid #ffffff;
  color: #fff;
  box-shadow:
    0 0 8px rgba(255,255,255,0.6),
    0 0 16px rgba(255,105,180,0.8),
    0 0 24px rgba(255,255,0,0.7);
  animation:
    rainbowFlow 4s linear infinite,
    rarity5Pulse 1s ease-in-out infinite alternate;
}

@keyframes rainbowFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes rarity5Pulse {
  0%   { transform: scale(1); }
  100% { transform: scale(1.1); }
}
/* アニメーション（SR以上） */
@keyframes pulseRare {
  from { transform: scale(1); }
  to   { transform: scale(1.05); }
}
/* その他 */
.item-line { margin: 0.2rem 0; }
.item-rarity { font-weight: bold; }
.undiscovered { color: #aaa; }

.stats-table td {
    padding: 0.2rem 0.5rem;
    text-align: left;
}

/* 施設下の強化ボックス */
.upgrade-box {
  border-top: 1px solid #aaa;
  margin-top: 12px;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 強化ボタン共通：指マークにしたい */
.upgrade-box button {
  cursor: pointer;   /* ← ここを追加 */
}

/* ボタン共通でツールチップを持たせる */
[data-tooltip] {
  position: relative;
}

/* ツールチップ本体（非表示） */
.tooltip-box {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 4px;
  z-index: 1000;
}

/* 表示トグル用 */
.show-tooltip .tooltip-box {
  display: block;
}

/* モバイルで右端に当たった場合の簡易折返し */
@media (max-width: 480px) {
  .tooltip-box {
    left: 0;
    transform: translateX(0);
  }
}
/* purchase mode button highlight */
#purchase-mode button.active-mode{
  background:#ffda57;
  font-weight:bold;
}
.disabled-btn{
  opacity:0.5;
  cursor:default !important;
}
.facility-buttons{
  display:flex;
  justify-content:center;
  margin-top:0.5rem;
}
/* ボタンがロック中の見た目だけ変える（クリックは阻害しない） */
.locked-btn {
  opacity: 0.5;
  cursor: pointer;
}

.gacha-cost {
  font-weight: bold;
  font-size: 18px;
  color: #fff; /* ベースを白に */
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000; /* 黒の縁取りで背景に依存しない */
  background-color: rgba(0,0,0,0.3); /* 透過黒背景でさらに強調 */
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 8px; /* 下に余白 */
}

.gacha-message {
  font-size: 14px;
  font-weight: bold;
  padding: 6px 10px;
  margin-top: 8px;    /* 上に余白 */
  margin-bottom: 8px; /* 下に余白 */
  border-radius: 6px;
  font-family: "メイリオ", sans-serif;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* 🔸図鑑未完成スタイル */
.gacha-message-incomplete {
  color: #fffae5;
  background-color: rgba(50, 50, 50, 0.5);
  border-left: 4px solid #f1c40f;
}

/* 🟢図鑑コンプリート後スタイル */
.gacha-message-complete {
  color: #fff;
  background: linear-gradient(90deg, #43cea2, #185a9d); /* グラデ背景 */
  border-left: 6px solid #00ffd9;
  animation: pulseGlow 1.5s infinite alternate;
}

/* 光るアニメーション */
@keyframes pulseGlow {
  0% { box-shadow: 0 0 6px #00ffd9; }
  100% { box-shadow: 0 0 12px #00ffd9, 0 0 20px #00ffd9; }
}

.gacha-button {
  padding: 10px 16px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  color: white;
}

/* 1回引く - 白くぼんやり */
.glow-white {
  background-color: #444;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
  animation: glowWhite 2s ease-in-out infinite alternate;
  border: 4px solid #aaa;
}

@keyframes glowWhite {
  from { box-shadow: 0 0 10px rgba(255, 255, 255, 0.2); }
  to   { box-shadow: 0 0 20px rgba(255, 255, 255, 0.6); }
}

/* 10回引く - 金色に派手に */
.glow-gold {
  background-color: #e6b800;
  color: #fff8dc;
  animation: glowGold 1.5s ease-in-out infinite alternate;
  border: 4px solid #ffdf00;
}

@keyframes glowGold {
  from { box-shadow: 0 0 10px #e6b800; }
  to   { box-shadow: 0 0 25px #ffcc00; }
}

/* 100回引く - 虹色グラデーション + 輝き */
.glow-rainbow {
  background: linear-gradient(270deg, red, orange, yellow, green, blue, indigo, violet);
  background-size: 400% 400%;
  animation: rainbowGlow 6s ease infinite, glowRainbow 1s ease-in-out infinite alternate;
  color: white;
  border: 4px solid #ffffff; /* 明るめで統一感を持たせる */
box-shadow: 0 0 8px 2px rgba(255,255,255,0.6);
}

@keyframes rainbowGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes glowRainbow {
  from { box-shadow: 0 0 12px #fff; }
  to   { box-shadow: 0 0 24px #fff; }
}

.can-upgrade {
  animation: glowPulse 1.6s ease-in-out infinite alternate;
  box-shadow: 0 0 8px rgba(0, 255, 128, 0.4),
              0 0 16px rgba(0, 255, 128, 0.2);
  border-color: #00ff80;
}

@keyframes glowPulse {
  0%   { box-shadow: 0 0 6px rgba(0,255,128,0.3); }
  100% { box-shadow: 0 0 18px rgba(0,255,128,0.6); }
}

/* 初期状態 */
/* tierごとの光り方を定義：既存の画像サイズ等は維持 */
.coin-tier-1 {
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.3));
}

.coin-tier-2 {
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.5))
          drop-shadow(0 0 8px rgba(255, 215, 0, 0.5));
}

.coin-tier-3 {
  filter: drop-shadow(0 0 14px rgba(255, 140, 0, 0.8)) 
          drop-shadow(0 0 8px rgba(255, 140, 0, 0.5));
}

.coin-tier-4 {
  filter: drop-shadow(0 0 16px rgba(255, 255, 0, 0.9)) 
          drop-shadow(0 0 24px rgba(255, 0, 255, 0.8)) 
          drop-shadow(0 0 32px rgba(0, 255, 255, 0.7));
  animation: hueSpin 1s ease-in-out infinite alternate;
}

.coin-tier-max {
  filter:
    drop-shadow(0 0 15px rgba(255, 255, 255, 0.8))
    drop-shadow(0 0 40px rgba(255, 215, 0, 0.6))
    drop-shadow(0 0 80px rgba(255, 0, 255, 0.4));
      animation: coinMaxPulse 3s linear infinite;
}

@keyframes hueSpin {
  from {
    filter: drop-shadow(0 0 12px rgba(255, 255, 0, 0.7)) 
            drop-shadow(0 0 20px rgba(255, 0, 255, 0.6)) 
            drop-shadow(0 0 28px rgba(0, 255, 255, 0.5));
  }
  to {
    filter: drop-shadow(0 0 20px rgba(255, 255, 0, 1)) 
            drop-shadow(0 0 30px rgba(255, 0, 255, 1)) 
            drop-shadow(0 0 40px rgba(0, 255, 255, 1));
  }
}
@keyframes coinMaxPulse {
  0%   { filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 16px rgba(255, 215, 0, 0.9)) drop-shadow(0 0 32px rgba(255, 0, 255, 0.6)) hue-rotate(0deg); }
  100% { filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 16px rgba(255, 215, 0, 0.9)) drop-shadow(0 0 32px rgba(255, 0, 255, 0.6)) hue-rotate(360deg); }
}


#coin::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 400px; /* ← 拡大 */
  height: 400px; /* ← 拡大 */
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0.1) 40%,
    rgba(255, 255, 255, 0) 90%
  );
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: -1;
  animation: pulseGlowCoin 3s infinite ease-in-out;
}

@keyframes pulseGlowCoin {
  0%   { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
  50%  { opacity: 0.9; transform: translate(-50%, -50%) scale(1.5); } /* ← 拡大 */
  100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
}

.zukan-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.gacha-card {
  width: 100px;
  padding: 6px;
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  position: relative;
}

/* 既存の rarity クラスをそのまま使うか調整 */
.rarity-1 { background-color: #ccc; }
.rarity-2 { background-color: #aaf; }
.rarity-3 { background-color: #6f6; }
.rarity-4 { background-color: #f6a; }
.rarity-5 { background: linear-gradient(45deg, red, orange, yellow, green, blue, indigo, violet); color: white; }

.undiscovered {
  color: #666;
  font-style: italic;
}

.zukan-complete {
  margin-left: 10px;
  padding: 2px 6px;
  background: linear-gradient(45deg, #4caf50, #81c784);
  color: white;
  border-radius: 6px;
  font-size: 0.8em;
  font-weight: bold;
  animation: pulseComplete 1.5s infinite alternate;
}

@keyframes pulseComplete {
  from { transform: scale(1); opacity: 0.8; }
  to   { transform: scale(1.1); opacity: 1; }
}

#all-complete-modal.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#all-complete-modal .modal-content {
  background: #fff;
  padding: 24px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 0 20px gold;
  animation: popIn 0.4s ease-out;
}

#all-complete-modal h2 {
  color: #f39c12;
  font-size: 1.5em;
  margin-bottom: 12px;
}

#all-complete-modal p {
  font-size: 1.2em;
  color: #333;
  margin-bottom: 20px;
}

#close-all-complete {
  padding: 8px 20px;
  font-size: 1em;
  background-color: #f39c12;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

#coin {
  position: relative;
  display: inline-block;
}