* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #06080d;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", sans-serif;
  color: #eef2f8;
  user-select: none;
}

#app { position: fixed; inset: 0; }
#app canvas { display: block; }

/* ---- HUD ---- */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none; /* ゲーム操作を邪魔しない */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
}

/* 共通パネル見出し */
.panel-title {
  font-size: 11px;
  letter-spacing: 3px;
  opacity: 0.7;
  margin-bottom: 6px;
  text-align: center;
}

/* ---- ラインスコア（左上） ---- */
#linescore {
  position: fixed;
  top: 18px;
  left: 18px;
  background: rgba(8, 12, 20, 0.66);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
#linescore-table {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
#linescore-table th, #linescore-table td {
  padding: 3px 7px;
  text-align: center;
  font-size: 13px;
  min-width: 18px;
}
#linescore-table th {
  font-weight: 600;
  opacity: 0.7;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}
#linescore-table td:first-child, #linescore-table th:first-child {
  text-align: left;
  font-weight: 700;
}
#linescore-table .row-red td:first-child { color: #ff6b6b; }
#linescore-table .row-yellow td:first-child { color: #ffd54a; }
#linescore-table .tot {
  border-left: 1px solid rgba(255,255,255,0.15);
  font-weight: 700;
}
#linescore-table .cur {
  background: rgba(127, 208, 255, 0.18);
  border-radius: 4px;
}
#linescore-table td.empty { opacity: 0.35; }

/* ---- ミニマップ（右） ---- */
#minimap-panel {
  position: fixed;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  background: rgba(8, 12, 20, 0.66);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
#minimap {
  display: block;
  width: 320px;
  height: 500px;
  border-radius: 8px;
}
#standing-label {
  margin-top: 8px;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
#minimap-legend {
  margin-top: 6px;
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 11px;
  opacity: 0.85;
}
#minimap-legend .lg-gold { color: #ffd34d; }
#minimap-legend .lg-dash { color: #cdd6e2; }

#scoreboard {
  display: flex;
  align-items: stretch;
  gap: 12px;
  align-self: center;
  background: rgba(8, 12, 20, 0.66);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.team {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
  padding: 2px 10px;
}
.team .label { font-size: 13px; letter-spacing: 2px; opacity: 0.85; }
.team .score { font-size: 40px; font-weight: 700; line-height: 1.1; }
.team-red .label, .team-red .score { color: #ff6b6b; }
.team-yellow .label, .team-yellow .score { color: #ffd54a; }

.end-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-left: 1px solid rgba(255,255,255,0.12);
  border-right: 1px solid rgba(255,255,255,0.12);
}
#end-label { font-size: 18px; font-weight: 600; }
#throw-label { font-size: 13px; opacity: 0.8; margin-top: 2px; }

#message {
  position: fixed;
  top: 112px;            /* スコアボードの下、レーンの手前あたり */
  left: 50%;
  transform: translateX(-50%);
  max-width: 80vw;
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  padding: 8px 22px;
  border-radius: 12px;
  background: rgba(8, 12, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  text-shadow: 0 2px 14px rgba(0,0,0,0.7);
  opacity: 0;
  transition: opacity 0.25s ease;
}
#message.show { opacity: 1; }

#controls {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#readouts {
  display: flex;
  gap: 10px;
}
#aim-readout, #turn-readout {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  background: rgba(8, 12, 20, 0.6);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 4px 12px;
}

#sweep-indicator {
  font-size: 16px;
  font-weight: 700;
  color: #7fe7ff;
  background: rgba(20, 60, 80, 0.55);
  border: 1px solid rgba(127, 231, 255, 0.5);
  border-radius: 8px;
  padding: 4px 14px;
  animation: sweep-pulse 0.5s ease-in-out infinite alternate;
}
#sweep-indicator.hidden { display: none; }
@keyframes sweep-pulse {
  from { opacity: 0.55; }
  to   { opacity: 1; }
}

#power-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
#power-wrap.hidden { display: none; }
#power-label { font-size: 12px; letter-spacing: 2px; opacity: 0.8; text-align: center; }
#power-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pw-end { font-size: 12px; opacity: 0.85; font-weight: 700; }
#power-bar {
  position: relative;
  width: 320px;
  height: 18px;
  border-radius: 10px;
  /* 弱(緑)→強(赤) を常にフル表示。バー自体は伸び縮みしない */
  background: linear-gradient(90deg, #4ade80, #facc15 55%, #ef4444);
  border: 1px solid rgba(255,255,255,0.3);
}
/* 現在のパワーを示す指針 */
#power-needle {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: 0%;
  width: 4px;
  margin-left: -2px;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(0,0,0,0.85);
}

#hint {
  font-size: 13px;
  opacity: 0.78;
  background: rgba(8, 12, 20, 0.55);
  border-radius: 8px;
  padding: 6px 12px;
}
.key {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 5px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.2);
  font-weight: 600;
}
