/**
 * style.css — スマホ向けスタイル
 * ゲーム画面全体のレイアウトとボタンのスタイルを定義する
 */

/* ===== Google Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700;900&display=swap');

/* ===== リセット & 基本設定 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent; /* スマホのタップハイライト無効化 */
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;         /* スクロールを完全に無効化 */
  background: #1a1a2e;
  font-family: 'Nunito', sans-serif;
  touch-action: none;       /* ブラウザのスクロール・ズームを無効化 */
}

/* ===== ゲームコンテナ ===== */
#gameContainer {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ===== ゲームキャンバス ===== */
#gameCanvas {
  display: block;
  width: 100%;
  height: 66.666vh;
  touch-action: none;
}

/* ===== ボタンエリア（画面下部に固定） ===== */
#buttonArea {
  position: relative;
  width: 100%;
  height: 33.334vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: #111122;
  /* iOS セーフエリア対応 */
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* ===== ボタンコンテナ ===== */
#buttonContainer {
  width: 100%;
  height: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

/* ===== ボタン共通スタイル上書き ===== */
.game-btn {
  pointer-events: all; /* ボタン自体はクリック受付 */
  width: 100%;
  max-width: none;
  flex: 1;
  min-height: 64px;
  border: none;
  border-radius: 16px;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition:
    transform 0.08s ease,
    background-color 0.1s ease,
    box-shadow 0.08s ease,
    filter 0.08s ease;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  position: relative;
  overflow: hidden;
}

/* ===== 警告テキスト ===== */
.warning-text {
  font-size: 11px;
  color: #ffbaba;
  text-align: center;
  margin: 0;
  opacity: 0.85;
  font-weight: 700;
}

/* 押したときの共通エフェクト */
.game-btn:active,
.game-btn.active,
.game-btn.pressed {
  transform: scale(0.95);
  filter: brightness(0.9);
}

/* Disabled */
.game-btn:disabled,
.game-btn.disabled {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.5);
}

/* ===== こぐボタン ===== */
.pump-btn {
  background: linear-gradient(135deg, #00B4DB, #0083B0);
  color: white;
  box-shadow:
    0 4px 15px rgba(0, 131, 176, 0.45),
    0 2px 0px rgba(0, 50, 80, 0.8),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

.pump-btn.active {
  background: linear-gradient(135deg, #00D4FB, #00A3D0);
  box-shadow:
    0 2px 8px rgba(0, 131, 176, 0.3),
    0 1px 0px rgba(0, 50, 80, 0.8);
}

/* ===== とばすボタン（靴） ===== */
.launch-shoe-btn {
  background: linear-gradient(135deg, #FFA000, #FF6F00);
  color: white;
  box-shadow:
    0 4px 15px rgba(255, 111, 0, 0.45),
    0 2px 0px rgba(130, 40, 0, 0.8),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

/* ===== とぶボタン（人） ===== */
.launch-human-btn {
  background: linear-gradient(135deg, #FF5252, #D50000);
  color: white;
  box-shadow:
    0 4px 15px rgba(213, 0, 0, 0.45),
    0 2px 0px rgba(100, 0, 0, 0.8),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

/* ===== ボタンのアイコン部分 ===== */
.btn-icon {
  font-size: 36px;
  line-height: 1;
}

/* ===== ボタンのテキスト ===== */
.btn-label {
  font-weight: 700;
  font-size: 28px;
  line-height: 1;
  opacity: 0.95;
}

/* ===== 押しっぱなし・ブースト時のフィードバック ===== */
.pump-btn.boost {
  background: linear-gradient(135deg, #4DD0E1, #00BCD4);
}

/* ===== ローディング画面 ===== */
#loading {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  z-index: 100;
  transition: opacity 0.5s ease;
}

#loading.hidden {
  opacity: 0;
  pointer-events: none;
}

#loading h1 {
  font-size: 32px;
  font-weight: 900;
  margin: 0 0 8px;
  background: linear-gradient(135deg, #00E5FF, #FF6D00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#loading p {
  font-size: 15px;
  opacity: 0.6;
  margin: 0;
}

/* ===== ショップ開くボタン ===== */
.shop-open-btn {
  position: absolute;
  top: 90px;
  right: 16px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.6);
  color: #FFD700;
  border: 2px solid #FFD700;
  border-radius: 20px;
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 4px 8px rgba(0,0,0,0.5);
  transition: transform 0.1s, opacity 0.3s;
}
.shop-open-btn:active {
  transform: scale(0.95);
}
.shop-open-btn.hidden {
  display: none;
}

/* ===== ショップモーダル ===== */
#shopModal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 20, 0.85); /* 半透明の暗い背景 */
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease;
  padding: 20px;
}
#shopModal.hidden {
  opacity: 0;
  pointer-events: none;
}

.shop-content {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(145deg, #1e1e38, #2a2a4a);
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.shop-header h2 {
  margin: 0;
  color: white;
  font-size: 22px;
}

.shop-coins {
  color: #FFD700;
  font-weight: bold;
  font-size: 18px;
  background: rgba(0,0,0,0.4);
  padding: 6px 12px;
  border-radius: 12px;
}

#shopCoinCount {
  color: white;
  margin-left: 8px;
}

.close-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 8px;
}

.shop-equip-slots {
  padding: 10px 20px;
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  text-align: right;
  background: rgba(0,0,0,0.1);
}

.shop-item-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* スクロールバーを非表示にする */
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* IE/Edge */
}

.shop-item-list::-webkit-scrollbar {
  display: none;                  /* Chrome, Safari, Opera */
}

.shop-item {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s, transform 0.2s;
}

.shop-item.equipped {
  border-color: #00E5FF;
  background: rgba(0, 229, 255, 0.08);
}

.item-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.item-name {
  color: white;
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 4px;
}

.item-desc {
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  line-height: 1.4;
}

.item-price {
  color: #FFD700;
  font-weight: bold;
  font-size: 16px;
}

.item-actions {
  display: flex;
  justify-content: flex-end;
}

.shop-action-btn {
  padding: 8px 24px;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.1s;
}
.shop-action-btn:active {
  transform: scale(0.95);
}

.btn-buy {
  background: #FF6D00;
  color: white;
  box-shadow: 0 2px 8px rgba(255, 109, 0, 0.4);
}
.btn-equip {
  background: #00C853;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 200, 83, 0.4);
}
.btn-unequip {
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
}
.btn-disabled {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.3);
  pointer-events: none;
}
  
/* ===== ショップフッター（初期化ボタンなど） ===== */
.shop-footer {
  padding: 16px 20px;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  justify-content: center;
}

.reset-btn {
  background: transparent;
  color: #ff5252;
  border: 1px solid rgba(255, 82, 82, 0.4);
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.reset-btn:active {
  background: rgba(255, 82, 82, 0.1);
  transform: scale(0.95);
}
/* ===== 結果表示モーダル ===== */
#resultModal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 30, 0.78); /* 半透明の暗い背景 */
  z-index: 300;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
  transition: opacity 0.4s ease;
  padding: 20px;
}
#resultModal.hidden {
  opacity: 0;
  pointer-events: none;
}

.result-card {
  width: 100%;
  max-width: 310px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

#resultTitle {
  margin: 0 0 10px;
  color: #FFD700;
  font-size: 22px;
  font-weight: 900;
  text-shadow: 0 4px 6px rgba(0,0,0,0.6);
}

.result-distance {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
}

#resultDistValue {
  color: white;
  font-size: 54px;
  font-weight: 900;
  line-height: 1;
}

.result-distance .unit {
  color: rgba(255,255,255,0.8);
  font-size: 18px;
  font-weight: 700;
}

.result-rank {
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  text-align: center;
  margin: 10px 0;
}

.result-divider {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: 15px 0;
}

.result-coins {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
}

.result-label {
  color: #FFD700;
  font-size: 14px;
  font-weight: 700;
}

.earned-coins {
  color: white;
  font-size: 30px;
  font-weight: 900;
}

.bonus-text {
  color: #FF6D00;
  font-size: 12px;
}

.total-coins {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  margin-bottom: 12px;
}

.retry-guide {
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
  margin: 0;
}

/* ===== バレルコントロール ===== */
.barrel-control {
  width: 100%;
  background: rgba(249, 115, 22, 0.12);
  border: 1.5px solid rgba(249, 115, 22, 0.4);
  border-radius: 14px;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.2s;
}
.barrel-control.hidden {
  display: none;
}

.barrel-control-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.barrel-icon {
  font-size: 18px;
  line-height: 1;
}

.barrel-title {
  color: #F97316;
  font-weight: 900;
  font-size: 14px;
  flex: 1;
}

.barrel-deg {
  color: white;
  font-weight: 900;
  font-size: 16px;
  min-width: 42px;
  text-align: right;
}

.barrel-slider-wrap {
  width: 100%;
}

.barrel-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to right, #F97316, #FBBF24);
  outline: none;
  cursor: pointer;
}
.barrel-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: white;
  border: 3px solid #F97316;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.barrel-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: white;
  border: 3px solid #F97316;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* ===== 確認モーダル ===== */
#confirmModal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
  padding: 24px;
  transition: opacity 0.3s ease;
}

#confirmModal.hidden {
  opacity: 0;
  pointer-events: none;
}

.confirm-card {
  width: 100%;
  max-width: 340px;
  background: #1e1e30;
  border-radius: 28px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.1);
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.confirm-card h2 {
  color: #ff5252;
  margin: 0 0 16px;
  font-size: 22px;
  font-weight: 900;
}

.confirm-card p {
  color: rgba(255,255,255,0.7);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 32px;
}

.confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-danger {
  background: #ff5252;
  color: white;
  border: none;
  padding: 16px;
  border-radius: 16px;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
}

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

.confirm-actions button:active {
  transform: scale(0.96);
  filter: brightness(0.9);
}
