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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #87ceeb;
  color: #f8fafc;
}

#canvas-wrap {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

#canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

/* HUD */
.hud {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 10;
  gap: 12px;
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}

.bar-card {
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 8px 12px;
}

.bar-card.compact {
  padding: 6px 12px;
}

.bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
  color: #e2e8f0;
}

.bar-track {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  overflow: hidden;
}

.bar-track.thin {
  height: 7px;
}

.bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  transition: width 0.1s ease-out;
}

.bar-fill.hp {
  background: linear-gradient(90deg, #ff4d6d, #51cf66);
}

.bar-fill.dash {
  background: linear-gradient(90deg, #38bdf8, #818cf8);
}

.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.wave-pill {
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px 20px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #ffd43b;
}

.enemies-pill {
  background: rgba(15, 23, 42, 0.65);
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #e2e8f0;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-box {
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 6px 14px;
  text-align: right;
  min-width: 92px;
}

.score-box .label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  color: #94a3b8;
}

.score-box .value {
  font-size: 1.2rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.score-box .value.accent {
  color: #38bdf8;
}

.icon-btn {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 1.1rem;
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(30, 41, 59, 0.95);
}

/* ウェーブ告知バナー */
.wave-banner {
  position: fixed;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid #ffd43b;
  color: #ffd43b;
  padding: 12px 32px;
  border-radius: 999px;
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  pointer-events: none;
  z-index: 15;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

/* 下部ヒント */
.controls-hint {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 6px 18px;
  display: flex;
  gap: 16px;
  font-size: 0.78rem;
  color: #cbd5e1;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
}

.controls-hint strong {
  color: #ffd43b;
}

/* モーダル・オーバーレイ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 17, 30, 0.56);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 30;
  padding: 16px;
}

.modal {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  padding: 32px 36px;
  max-width: 500px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.compact-modal {
  max-width: 400px;
}

.badge {
  display: inline-block;
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}

.badge.danger {
  background: rgba(255, 77, 109, 0.2);
  color: #ff6b81;
  border-color: rgba(255, 77, 109, 0.45);
}

.modal h1 {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  background: linear-gradient(90deg, #69db7c, #ffd43b, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 8px;
}

.modal h2 {
  font-size: 1.7rem;
  font-weight: 900;
  margin-bottom: 18px;
}

.lead {
  color: #cbd5e1;
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.control-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  text-align: left;
}

.control-grid > div {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.control-grid strong {
  color: #ffd43b;
}

.best-line {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffd43b;
  margin-bottom: 20px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}

.result-grid > div {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-grid span {
  font-size: 0.72rem;
  color: #94a3b8;
}

.result-grid strong {
  font-size: 1.3rem;
  color: #ffffff;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cta-btn {
  width: 100%;
  background: linear-gradient(135deg, #40c057, #22b8cf);
  color: #091318;
  border: none;
  border-radius: 12px;
  padding: 13px 20px;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease;
}

.cta-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.secondary-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 11px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}
