/* ============================================================
   style.css — 協力型マルチブロック崩し
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700;900&family=Outfit:wght@400;700;900&display=swap');

:root {
  --bg-dark: #0a0e27;
  --bg-grad1: #0f1442;
  --bg-grad2: #1a0b3e;
  --accent-blue: #4fc3f7;
  --accent-pink: #f06292;
  --accent-yellow: #ffd54f;
  --accent-green: #69f0ae;
  --accent-red: #ff5252;
  --accent-purple: #b388ff;
  --text-white: #f5f5f5;
  --text-muted: #9e9e9e;
  --player1: #ff6b6b;
  --player2: #4ecdc4;
  --player3: #ffd93d;
  --player4: #a855f7;
  --glass-bg: rgba(255,255,255,0.06);
  --glass-border: rgba(255,255,255,0.12);
  --panel-radius: 20px;
}

*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; }
html,body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-grad1) 40%, var(--bg-grad2) 100%);
  font-family: 'Outfit','Noto Sans JP', sans-serif;
  color: var(--text-white);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  cursor: default;
}

/* Canvas */
#gameCanvas {
  display: block;
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; height: 100%;
  max-width: 900px;
}

/* ========== 共通オーバーレイ ========== */
.overlay {
  position: absolute;
  top:0; left:0; width:100%; height:100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.4s ease;
}
.overlay.hidden { opacity:0; pointer-events:none; }

/* ========== 設定画面 ========== */
#setupScreen {
  background: radial-gradient(ellipse at center, rgba(15,20,66,0.95) 0%, rgba(10,14,39,0.98) 100%);
}
#setupScreen .title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-pink), var(--accent-yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.3em;
  text-align: center;
  line-height: 1.3;
}
#setupScreen .subtitle {
  font-size: clamp(0.85rem, 2.5vw, 1.1rem);
  color: var(--text-muted);
  margin-bottom: 2em;
}

.setup-section {
  margin-bottom: 1.5em;
  text-align: center;
}
.setup-section h2 {
  font-size: clamp(0.9rem, 2.5vw, 1.15rem);
  font-weight: 700;
  margin-bottom: 0.6em;
  color: var(--accent-blue);
}

.btn-group {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-group .btn {
  width: clamp(52px, 12vw, 72px);
  height: clamp(52px, 12vw, 72px);
  border: 2px solid var(--glass-border);
  border-radius: 16px;
  background: var(--glass-bg);
  color: var(--text-white);
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.2rem, 3.5vw, 1.6rem);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-group .btn:active,
.btn-group .btn.selected {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-color: var(--accent-blue);
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(79,195,247,0.4);
}

.start-btn {
  margin-top: 1.5em;
  padding: 16px 60px;
  border: none;
  border-radius: 50px;
  font-family: 'Outfit','Noto Sans JP', sans-serif;
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
  cursor: pointer;
  box-shadow: 0 4px 25px rgba(240,98,146,0.4);
  transition: all 0.25s ease;
}
.start-btn:active {
  transform: scale(0.96);
  box-shadow: 0 2px 12px rgba(240,98,146,0.5);
}

/* ========== カウントダウン ========== */
#countdownScreen {
  background: rgba(10,14,39,0.85);
  pointer-events: none;
}
#countdownScreen .countdown-text {
  font-size: clamp(6rem, 22vw, 12rem);
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-yellow), var(--accent-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: countPulse 0.4s ease-out;
  text-shadow: none;
}
@keyframes countPulse {
  0%  { transform: scale(1.8); opacity:0; }
  60% { transform: scale(0.95); opacity:1; }
  100%{ transform: scale(1); opacity:1; }
}

/* ========== HUD ========== */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  margin: 0 auto;
  max-width: 900px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  z-index: 5;
  pointer-events: none;
}
#hud .timer {
  font-size: clamp(1.3rem, 4vw, 2rem);
  font-weight: 900;
  color: var(--accent-yellow);
  text-shadow: 0 0 12px rgba(255,213,79,0.5);
}
#hud .timer.urgent {
  color: var(--accent-red);
  text-shadow: 0 0 16px rgba(255,82,82,0.7);
  animation: timerBlink 0.5s infinite;
}
@keyframes timerBlink {
  0%,100% { opacity:1; }
  50%     { opacity:0.6; }
}
#hud .score {
  font-size: clamp(0.9rem, 2.5vw, 1.2rem);
  font-weight: 700;
}

/* ========== ギガ・バースト ========== */
.giga-burst-overlay {
  position: absolute;
  top:0; left:0; width:100%; height:100%;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.giga-burst-text {
  font-size: clamp(2.5rem, 10vw, 5rem);
  font-weight: 900;
  background: linear-gradient(135deg, #fff, var(--accent-yellow), #fff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gigaFlash 1.5s ease-out forwards;
  text-shadow: none;
  filter: drop-shadow(0 0 30px rgba(255,255,255,0.8));
}
@keyframes gigaFlash {
  0%   { transform: scale(0.3); opacity:0; }
  20%  { transform: scale(1.3); opacity:1; }
  40%  { transform: scale(0.95); }
  60%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity:0; }
}

/* ========== リザルト画面 ========== */
#resultScreen {
  background: radial-gradient(ellipse at center, rgba(15,20,66,0.96) 0%, rgba(10,14,39,0.99) 100%);
}
#resultScreen .result-title {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 900;
  margin-bottom: 0.3em;
  background: linear-gradient(135deg, var(--accent-yellow), var(--accent-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
#resultScreen .result-msg {
  font-size: clamp(0.85rem, 2.5vw, 1.1rem);
  color: var(--accent-yellow);
  margin-bottom: 1.2em;
}
.result-scores {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1em;
}
.result-score-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 14px 22px;
  text-align: center;
  min-width: 100px;
  backdrop-filter: blur(8px);
}
.result-score-card .player-label {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.result-score-card .player-score {
  font-size: 1.8rem;
  font-weight: 900;
}
.result-total {
  font-size: clamp(1rem, 3vw, 1.4rem);
  margin: 0.5em 0;
}
.result-bounces {
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  color: var(--text-muted);
  margin-bottom: 1.2em;
}
.retry-btn {
  padding: 14px 50px;
  border: none;
  border-radius: 50px;
  font-family: 'Outfit','Noto Sans JP', sans-serif;
  font-size: clamp(1rem, 2.8vw, 1.2rem);
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(105,240,174,0.35);
  transition: all 0.2s;
}
.retry-btn:active {
  transform: scale(0.96);
}

/* ========== 管理者メニュー ========== */
#adminMenu {
  position: absolute;
  top:0; left:0; width:100%; height:100%;
  background: rgba(0,0,0,0.8);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
#adminMenu.hidden { display: none; }
#adminMenu .admin-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--accent-yellow);
}
#adminMenu button {
  padding: 12px 40px;
  border: 2px solid var(--glass-border);
  border-radius: 12px;
  background: var(--glass-bg);
  color: white;
  font-family: 'Outfit','Noto Sans JP', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
#adminMenu button:active { background: rgba(255,255,255,0.15); }

/* ========== 星による通知 ========== */
.item-notify {
  position: absolute;
  z-index: 15;
  font-size: clamp(1rem, 3vw, 1.4rem);
  font-weight: 900;
  pointer-events: none;
  animation: floatUp 1.2s ease-out forwards;
}
@keyframes floatUp {
  0%   { opacity:1; transform: translateY(0) scale(1); }
  100% { opacity:0; transform: translateY(-60px) scale(1.2); }
}
