/* ====== style.css ====== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, sans-serif; background-color: #f0f2f5; color: #0f1419; }
#app { max-width: 600px; margin: 0 auto; background-color: #ffffff; min-height: 100vh; position: relative; padding-bottom: 50px; }

.header { position: sticky; top: 0; background-color: rgba(255, 255, 255, 0.85); backdrop-filter: blur(12px); display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid #eff3f4; z-index: 100; cursor: pointer; }
.header h1 { font-size: 20px; font-weight: bold; }

#game-ui { position: sticky; top: 49px; background: #fff; border-bottom: 1px solid #eff3f4; display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; font-size: 14px; font-weight: bold; z-index: 90; }

#mode-select { padding: 4px; border-radius: 4px; border: 1px solid #ccc; font-size: 12px; margin-right: 10px; background: #f7f9f9; cursor: pointer; }

#battery-container { flex-grow: 1; margin: 0 12px; background: #e0e0e0; height: 10px; border-radius: 5px; overflow: hidden; }
#battery-bar { height: 100%; width: 100%; background: #28a745; transition: width 0.3s, background-color 0.3s; }

#trap-btn { position: fixed; bottom: 20px; right: 20px; width: 48px; height: 48px; border-radius: 24px; background: rgba(255, 255, 255, 0.9); border: 1px solid #ccc; font-size: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.2); cursor: pointer; display: none; z-index: 100; }
#loading-overlay { position: absolute; top: 50px; left: 0; width: 100%; height: 100%; background-color: rgba(255, 255, 255, 0.7); z-index: 80; display: none; justify-content: center; padding-top: 20px; }
.spinner { width: 30px; height: 30px; border: 3px solid rgba(29, 161, 242, 0.2); border-top-color: #1da1f2; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }
#bottom-loading { text-align: center; padding: 20px; display: none; }

.post { display: flex; padding: 12px 16px; border-bottom: 1px solid #eff3f4; transition: background-color 0.2s; }
.post:hover { background-color: #f7f9f9; cursor: pointer; }

.post-icon { width: 48px; height: 48px; border-radius: 50%; margin-right: 12px; flex-shrink: 0; background-size: cover; background-position: center; border: 1px solid #eff3f4; background-color: #e0e0e0; }

.post-content { flex-grow: 1; overflow: hidden; }
.post-header { display: flex; align-items: baseline; margin-bottom: 4px; }
.user-name { font-weight: bold; margin-right: 4px; }
.user-id { color: #536471; font-size: 15px; }
.post-text { font-size: 15px; line-height: 1.5; word-wrap: break-word; margin-bottom: 8px; }
.post-image { width: 100%; border-radius: 16px; border: 1px solid #eff3f4; margin-bottom: 8px; }
.ad-label { font-size: 12px; color: #536471; margin-bottom: 4px; display: block; }

/* ★追加：ゲームオーバーとシェア機能のデザイン */
#game-over-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 200; display: none; flex-direction: column; justify-content: center; align-items: center; color: white; text-align: center; padding: 20px; backdrop-filter: blur(5px); }
#game-over-text { font-size: 16px; line-height: 1.6; white-space: pre-wrap; margin-bottom: 30px; background: rgba(255,255,255,0.1); padding: 20px; border-radius: 10px; border: 1px solid #444; font-weight: bold; text-align: left; }
.share-btn { padding: 12px 24px; background: #1da1f2; color: white; border: none; border-radius: 24px; font-size: 16px; font-weight: bold; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: background 0.2s; }
.share-btn:hover { background: #1a91da; }
.share-btn:active { transform: scale(0.95); }
.retry-btn { margin-top: 20px; padding: 10px 20px; background: transparent; color: #aaa; border: 1px solid #aaa; border-radius: 20px; cursor: pointer; }
.retry-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* --- VFX 演出 --- */

/* 1. 偽物を踏んだ時のグリッチ（バグ）演出 */
.glitch {
  animation: glitch-anim 0.15s infinite;
  filter: invert(1) hue-rotate(180deg);
}
@keyframes glitch-anim {
  0% { transform: translate(5px, 5px); }
  25% { transform: translate(-5px, -5px); }
  50% { transform: translate(-5px, 5px); }
  75% { transform: translate(5px, -5px); }
  100% { transform: translate(0); }
}

/* 2. バッテリー低下アラート（画面の縁が強く赤く光る） */
.low-battery-alert {
  animation: pulse-red 1s infinite;
}
@keyframes pulse-red {
  0% { box-shadow: inset 0 0 0px red; }
  50% { box-shadow: inset 0 0 80px rgba(255, 0, 0, 0.8); }
  100% { box-shadow: inset 0 0 0px red; }
}

/* 3. レベルアップ時のフラッシュ（確実に画面全体を白くする） */
.level-up-flash {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background-color: white;
  pointer-events: none;
  z-index: 9999;
  animation: flash-white 0.5s ease-out forwards;
}
@keyframes flash-white {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* 独自イラスト（絵文字）をテキストの行に自然になじませる設定 */
.alien-img {
  height: 1.5em; /* 文字の高さに合わせる（大きくしたい場合は 1.5em などに調整） */
  width: auto;   /* 縦横の比率を崩さない */
  vertical-align: middle; /* 行の真ん中（テキストのベースライン）に揃える */
  margin: 0 1px; /* 画像と画像、画像と文字の間にほんの少しだけ隙間をあける */
  display: inline-block;
  pointer-events: none; /* スマホで画像を長押しして保存メニューが出るのを防ぐ */
}