* { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; font-family: "Hiragino Sans", "Yu Gothic UI", sans-serif; }
canvas { display: block; }

#ui {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 16px 24px;
  pointer-events: none;
  z-index: 10;
}

.debug-panel {
  position: fixed;
  top: 16px;
  right: 24px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  z-index: 20;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.debug-panel .debug-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* クレジットボタン */
.credits-btn {
  position: fixed;
  top: 56px;
  right: 24px;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  cursor: pointer;
  z-index: 20;
  transition: background 0.2s, border-color 0.2s;
}
.credits-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.6);
}

/* クレジットダイアログ */
.credits-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  padding: 24px;
  background: rgba(20, 20, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  color: #fff;
  overflow-y: auto;
  z-index: 1000;
}
.credits-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}
.credits-title {
  margin: 0 0 8px 0;
  font-size: 32px;
  text-align: center;
  color: #ffffff;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.6), 0 0 30px rgba(136, 204, 255, 0.4);
}
.credits-dialog h2 {
  margin: 0 0 16px 0;
  font-size: 18px;
  text-align: center;
  color: #88ccff;
  text-shadow: 0 0 10px rgba(136, 204, 255, 0.5);
}
.credits-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.credits-content section {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.credits-content section:last-of-type {
  border-bottom: none;
}
.credits-content h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.credits-content p {
  margin: 4px 0;
  font-size: 14px;
}
.credits-content ul {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
}
.credits-content li {
  margin: 4px 0;
}
.credits-content a {
  color: #88ccff;
  text-decoration: none;
}
.credits-content a:hover {
  text-decoration: underline;
}
.credits-content .license-note {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
}
.credits-content .ggj-section {
  text-align: center;
  padding-top: 8px;
}
.credits-content .ggj-section h3 {
  color: #ff8866;
}
.credits-close-btn {
  display: block;
  margin: 20px auto 0;
  padding: 10px 32px;
  background: rgba(136, 204, 255, 0.2);
  border: 1px solid rgba(136, 204, 255, 0.5);
  border-radius: 6px;
  color: #88ccff;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.credits-close-btn:hover {
  background: rgba(136, 204, 255, 0.35);
}
.debug-panel label {
  color: rgba(255,255,255,0.9);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.debug-panel input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}
.debug-btn {
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.debug-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.6);
}
.debug-btn.active {
  background: rgba(100, 150, 255, 0.3);
  border-color: rgba(100, 150, 255, 0.7);
}
.debug-panel .debug-fps {
  display: none;
  margin-left: 0;
  color: rgba(255,255,255,0.9);
  font-size: 12px;
}

/* 生存時間の大型表示 */
.survival-display {
  position: fixed;
  top: 16px;
  left: calc(50% + 120px);
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  z-index: 15;
}
.survival-display .survival-time {
  font-size: 36px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8), 0 0 20px rgba(255,200,100,0.5);
  letter-spacing: 2px;
}
.survival-display .survival-milestone {
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  margin-top: 4px;
  background: rgba(0,0,0,0.4);
  padding: 4px 12px;
  border-radius: 10px;
}

/* 境界警告 */
.boundary-warning {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(180, 0, 0, 0.9);
  color: #fff;
  padding: 8px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  border: 2px solid #ff4444;
  animation: boundaryPulse 0.8s ease-in-out infinite;
  display: none;
  z-index: 100;
  pointer-events: none;
}
.boundary-warning.visible {
  display: block;
}
@keyframes boundaryPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* 成長選択ダイアログ */
.growth-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.growth-dialog.hidden {
  display: none;
}
.growth-dialog-content {
  background: linear-gradient(135deg, rgba(30, 30, 60, 0.95), rgba(20, 20, 40, 0.98));
  border: 2px solid rgba(100, 150, 255, 0.5);
  border-radius: 16px;
  padding: 32px 48px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 60px rgba(100, 150, 255, 0.2);
  animation: growthDialogAppear 0.3s ease-out;
}
@keyframes growthDialogAppear {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.growth-dialog-title {
  font-size: 28px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 8px;
  text-shadow: 0 2px 10px rgba(100, 150, 255, 0.5);
}
.growth-dialog-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 24px;
}
.growth-dialog-options {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.growth-option {
  background: rgba(50, 80, 120, 0.6);
  border: 2px solid rgba(100, 150, 255, 0.4);
  border-radius: 12px;
  padding: 20px 24px;
  min-width: 140px;
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
}
.growth-option:hover {
  background: rgba(80, 120, 180, 0.8);
  border-color: rgba(150, 200, 255, 0.8);
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(100, 150, 255, 0.3);
}
.growth-option-icon {
  font-size: 32px;
  margin-bottom: 8px;
}
.growth-option-name {
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 4px;
}
.growth-option-value {
  font-size: 14px;
  color: #88ff88;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

/* 敗北・輪廻転生ダイアログ */
.defeat-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(20, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.defeat-dialog.hidden {
  display: none;
}
.defeat-dialog-content {
  background: linear-gradient(135deg, rgba(60, 20, 20, 0.95), rgba(40, 10, 10, 0.98));
  border: 2px solid rgba(255, 100, 100, 0.5);
  border-radius: 16px;
  padding: 40px 60px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 60px rgba(255, 50, 50, 0.2);
  animation: defeatDialogAppear 0.5s ease-out;
}
@keyframes defeatDialogAppear {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.defeat-dialog-title {
  font-size: 48px;
  font-weight: bold;
  color: #ff6666;
  margin-bottom: 24px;
  text-shadow: 0 2px 20px rgba(255, 100, 100, 0.5);
}
.defeat-dialog-stats {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 24px;
  line-height: 1.8;
}
.defeat-dialog-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 24px;
}
.defeat-dialog-button {
  background: linear-gradient(135deg, #664422, #442211);
  border: 2px solid rgba(255, 200, 100, 0.5);
  border-radius: 8px;
  padding: 16px 48px;
  font-size: 18px;
  font-weight: bold;
  color: #ffdd88;
  cursor: pointer;
  transition: all 0.2s ease;
}
.defeat-dialog-button:hover {
  background: linear-gradient(135deg, #886633, #664422);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(255, 200, 100, 0.3);
}

/* ライバル出現警告 */
.rival-warning {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 500;
  pointer-events: none;
  animation: rivalWarningPulse 0.5s ease-in-out 3;
}
.rival-warning.hidden {
  display: none;
}
.rival-warning-text {
  font-size: 48px;
  font-weight: bold;
  color: #ff4444;
  text-shadow: 0 0 30px rgba(255, 50, 50, 0.8), 0 0 60px rgba(255, 50, 50, 0.5);
}
@keyframes rivalWarningPulse {
  0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}
.debug-panel .debug-menu {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.25);
  width: 100%;
}
.debug-panel .debug-menu.visible {
  display: flex;
}
.debug-panel .debug-menu-legend {
  color: rgba(255,255,255,0.85);
  font-size: 11px;
  margin-bottom: 2px;
}
.debug-panel .debug-menu label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
}
.debug-panel input[type="radio"] {
  cursor: pointer;
  width: 14px;
  height: 14px;
}
.debug-panel .debug-state {
  font-size: 11px;
  color: rgba(255,255,255,0.9);
  font-variant-numeric: tabular-nums;
}

#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.3s ease;
}
#loading-overlay.hidden {
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}
#loading-overlay .spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
#loading-overlay .text {
  margin-top: 16px;
  color: #fff;
  font-size: 16px;
  letter-spacing: 0.15em;
}
#loading-overlay .progress-wrap {
  width: 280px;
  max-width: 80vw;
  height: 12px;
  margin-top: 20px;
  background: rgba(255,255,255,0.2);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.3);
}
#loading-overlay .progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 5px;
  transition: width 0.15s ease;
}
#loading-overlay .progress-pct {
  margin-top: 8px;
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.energy-wrap {
  max-width: 280px;
}
.energy-label {
  color: rgba(255,255,255,0.9);
  font-size: 12px;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.energy-bar-bg {
  height: 14px;
  background: rgba(0,0,0,0.5);
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.2);
}
.energy-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #4ade80, #22c55e);
  border-radius: 6px;
  transition: width 0.15s ease;
}
.energy-bar.low { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.energy-bar.critical { background: linear-gradient(90deg, #ef4444, #dc2626); }

.hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  letter-spacing: 0.1em;
  pointer-events: none;
  z-index: 10;
}

.direction-meter {
  position: fixed;
  bottom: 56px;
  right: 24px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  border: 2px solid rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}
.direction-meter .needle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 26px;
  margin-left: -2px;
  margin-top: -26px;
  background: linear-gradient(to top, rgba(255,255,255,0.3), #fff);
  border-radius: 2px;
  transform-origin: 2px 26px;
  box-shadow: 0 0 8px rgba(255,255,255,0.4);
}
.direction-meter .labels {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: rgba(255,255,255,0.7);
  font-weight: bold;
  letter-spacing: 0.05em;
}
.direction-meter .n { top: 4px; left: 50%; transform: translateX(-50%); position: absolute; }
.direction-meter .e { right: 6px; top: 50%; transform: translateY(-50%); position: absolute; }
.direction-meter .s { bottom: 4px; left: 50%; transform: translateX(-50%); position: absolute; }
.direction-meter .w { left: 6px; top: 50%; transform: translateY(-50%); position: absolute; }

.speed-meter {
  position: fixed;
  bottom: 56px;
  right: 106px;
  width: 72px;
  height: 44px;
  border-radius: 8px;
  background: rgba(0,0,0,0.4);
  border: 2px solid rgba(255,255,255,0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}
.speed-meter .label {
  font-size: 9px;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}
.speed-meter .value {
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px rgba(255,255,255,0.5);
}
.speed-meter .unit {
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  margin-left: 2px;
}
.speed-meter .gauge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: rgba(0,0,0,0.3);
  border-radius: 0 0 6px 6px;
  overflow: hidden;
}
.speed-meter .gauge-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  border-radius: 0 0 4px 4px;
  transition: width 0.08s ease-out;
}

.alt-meter {
  position: fixed;
  bottom: 56px;
  right: 184px;
  width: 72px;
  height: 44px;
  border-radius: 8px;
  background: rgba(0,0,0,0.4);
  border: 2px solid rgba(255,255,255,0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}
.alt-meter .label {
  font-size: 9px;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}
.alt-meter .value {
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px rgba(255,255,255,0.5);
}
.alt-meter .unit {
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  margin-left: 2px;
}
.alt-meter .gauge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: rgba(0,0,0,0.3);
  border-radius: 0 0 6px 6px;
  overflow: hidden;
}
.alt-meter .gauge-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 0 0 4px 4px;
  transition: width 0.08s ease-out;
}

.pos-meter {
  position: fixed;
  bottom: 56px;
  right: 262px;
  min-width: 100px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(0,0,0,0.4);
  border: 2px solid rgba(255,255,255,0.35);
  font-size: 11px;
  color: rgba(255,255,255,0.95);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  z-index: 10;
}
.pos-meter .label { font-size: 9px; letter-spacing: 0.1em; margin-bottom: 4px; color: rgba(255,255,255,0.7); }
.pos-meter .row { display: flex; gap: 8px; }
.pos-meter .row span { flex: 1; }

/* status panel */
.status-panel {
  position: fixed;
  top: 56px;
  left: 24px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.95);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.status-panel .status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.status-panel .status-row span:first-child { color: rgba(255,255,255,0.75); }
.status-panel .status-row span:last-child { min-width: 2em; text-align: right; }

/* equipment panel */
.equipment-panel {
  position: fixed;
  top: 200px;
  right: 24px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  pointer-events: none;
  z-index: 10;
  min-width: 180px;
  max-width: 220px;
}
.equipment-panel .equipment-header {
  font-size: 12px;
  color: rgba(255,255,255,0.95);
  margin-bottom: 8px;
  font-weight: bold;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  padding-bottom: 4px;
}
.equipment-panel .equipment-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* mask panel */
.mask-panel {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  pointer-events: none;
  z-index: 10;
  max-width: 400px;
}
.mask-panel .mask-header {
  font-size: 11px;
  color: rgba(255,255,255,0.9);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.mask-panel .mask-slots {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.mask-panel .mask-slot {
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  pointer-events: none;
  position: relative;
  overflow: hidden;
}

/* マスクの顔 */
.mask-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.mask-eye {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #000;
  border-radius: 50%;
  top: 8px;
}
.mask-eye-left { left: 5px; }
.mask-eye-right { right: 5px; }

.mask-brow {
  position: absolute;
  width: 7px;
  height: 2px;
  background: #222;
  top: 5px;
  border-radius: 1px;
}
.mask-brow-left { 
  left: 4px; 
  transform: rotate(10deg);
}
.mask-brow-right { 
  right: 4px; 
  transform: rotate(-10deg);
}

.mask-mouth {
  position: absolute;
  width: 10px;
  height: 3px;
  background: #111;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 1px;
}

.mask-level {
  position: absolute;
  bottom: 1px;
  right: 2px;
  font-size: 10px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 2px #000, 0 0 4px #000;
  z-index: 1;
}

/* buff panel */
.buff-panel {
  position: fixed;
  bottom: 280px;
  left: 24px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  pointer-events: none;
  z-index: 10;
}
.buff-panel .buff-header {
  font-size: 11px;
  color: rgba(255,255,255,0.9);
  margin-bottom: 6px;
}
.buff-panel .buff-active {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 24px;
  margin-bottom: 8px;
}
.buff-panel .buff-queue {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  min-height: 24px;
  max-width: 300px;
}
.buff-panel .buff-item {
  min-width: 60px;
  padding: 4px 8px;
  background: rgba(80,80,255,0.3);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-sizing: border-box;
}

/* enemy guide */
.enemy-guide {
  position: fixed;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  padding: 8px 10px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  pointer-events: none;
  z-index: 10;
  min-width: 80px;
}
.enemy-guide .enemy-guide-label {
  font-size: 10px;
  color: rgba(255,255,255,0.8);
  margin-bottom: 6px;
}
.enemy-guide .enemy-guide-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.enemy-guide .enemy-guide-empty {
  font-size: 10px;
  color: rgba(255,255,255,0.5);
}

/* combat log */
.combat-log {
  position: fixed;
  bottom: 330px;
  right: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  pointer-events: none;
  z-index: 100;
  max-width: 280px;
}
.combat-log-entry {
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: bold;
  white-space: nowrap;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.combat-log-entry.fading {
  opacity: 0;
  transform: translateY(-20px);
}
.combat-log-entry.attack {
  background: rgba(0, 100, 0, 0.85);
  color: #88ff88;
  border: 1px solid #44ff44;
}
.combat-log-entry.damage {
  background: rgba(100, 0, 0, 0.85);
  color: #ff8888;
  border: 1px solid #ff4444;
}
.combat-log-entry.defeat {
  background: rgba(100, 80, 0, 0.85);
  color: #ffdd44;
  border: 1px solid #ffaa00;
}
.combat-log-entry.mask {
  background: rgba(80, 0, 100, 0.85);
  color: #ff88ff;
  border: 1px solid #ff44ff;
}
.combat-log-entry.heal {
  background: rgba(0, 80, 100, 0.85);
  color: #88ffff;
  border: 1px solid #44ffff;
}
.enemy-guide .enemy-guide-item {
  font-size: 10px;
  color: rgba(255,255,255,0.9);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 4px;
}
.enemy-guide .enemy-guide-arrow {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 4px 6px 4px 0;
  border-color: transparent rgba(255,255,255,0.8) transparent transparent;
  transform-origin: center;
}
.enemy-guide .enemy-guide-unknown {
  color: rgba(255, 200, 100, 0.7);
  font-style: italic;
}
.enemy-guide .enemy-guide-question {
  font-size: 12px;
  font-weight: bold;
  color: rgba(255, 200, 100, 0.8);
}

/* マスクセンサー */
.mask-sensor {
  position: fixed;
  top: 50%;
  left: 24px;
  transform: translateY(-50%);
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(100, 0, 100, 0.6), rgba(60, 0, 60, 0.7));
  border: 2px solid rgba(255, 100, 255, 0.5);
  border-radius: 10px;
  pointer-events: none;
  z-index: 10;
  min-width: 100px;
  box-shadow: 0 0 20px rgba(255, 100, 255, 0.3);
  animation: maskSensorPulse 2s ease-in-out infinite;
}
.mask-sensor.hidden {
  display: none;
}
@keyframes maskSensorPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 100, 255, 0.3); }
  50% { box-shadow: 0 0 30px rgba(255, 100, 255, 0.6); }
}
.mask-sensor .mask-sensor-label {
  font-size: 11px;
  font-weight: bold;
  color: rgba(255, 200, 255, 0.9);
  margin-bottom: 8px;
  text-shadow: 0 0 10px rgba(255, 100, 255, 0.5);
}
.mask-sensor .mask-sensor-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mask-sensor .mask-sensor-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.95);
  font-weight: bold;
}
.mask-sensor .mask-sensor-arrow {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 8px 5px 0;
  border-color: transparent rgba(255, 150, 255, 0.9) transparent transparent;
  transform-origin: center;
  filter: drop-shadow(0 0 3px rgba(255, 100, 255, 0.8));
}
.mask-sensor .mask-sensor-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
}
.mask-sensor .mask-sensor-empty {
  font-size: 11px;
  color: rgba(255, 200, 255, 0.6);
  font-style: italic;
}

/* boss panel */
.boss-panel {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,200,100,0.5);
  border-radius: 8px;
  pointer-events: none;
  z-index: 10;
  font-size: 11px;
  color: rgba(255,255,255,0.95);
  font-variant-numeric: tabular-nums;
}
.boss-panel .boss-label {
  color: rgba(255,200,100,0.95);
  margin-bottom: 4px;
}
.boss-panel .boss-hp,
.boss-panel .boss-masks {
  font-size: 10px;
  color: rgba(255,255,255,0.85);
}
.boss-panel.hidden {
  display: none;
}

/* enemy health bar (for 3D overlay / DOM overlay) */
.enemy-health-wrap {
  position: absolute;
  width: 40px;
  height: 6px;
  pointer-events: none;
}
.enemy-health-wrap .enemy-health-bg {
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.3);
}
.enemy-health-wrap .enemy-health-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ef4444, #dc2626);
  border-radius: 2px;
  transition: width 0.1s ease;
}

/* ============================================
   戦闘時ピクチャーインピクチャー
   ============================================ */
.combat-pip {
  position: fixed;
  bottom: 120px;
  right: 24px;
  width: 180px;
  height: 200px;
  pointer-events: none;
  z-index: 25;
  transition: opacity 0.3s ease;
}
.combat-pip.hidden {
  opacity: 0;
  pointer-events: none;
}
.combat-pip-label {
  text-align: center;
  font-size: 10px;
  color: #ff6644;
  text-shadow: 0 0 5px rgba(255, 102, 68, 0.8);
  letter-spacing: 2px;
  margin-bottom: 4px;
  animation: pip-pulse 1s ease-in-out infinite;
}
@keyframes pip-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.combat-pip-canvas {
  width: 180px;
  height: 180px;
  border-radius: 8px;
  border: 2px solid rgba(255, 102, 68, 0.6);
  box-shadow: 0 0 15px rgba(255, 102, 68, 0.4);
  background: rgba(0, 0, 0, 0.5);
}

/* ============================================
   バックミラー（画面外からの攻撃時）
   ============================================ */
.rear-mirror {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.3s ease;
}
.rear-mirror.hidden {
  opacity: 0;
  pointer-events: none;
}
.rear-mirror-label {
  text-align: center;
  font-size: 12px;
  color: #ff4444;
  text-shadow: 0 0 8px rgba(255, 68, 68, 0.9);
  letter-spacing: 2px;
  margin-bottom: 4px;
  font-weight: bold;
  animation: rear-mirror-pulse 0.5s ease-in-out infinite;
}
@keyframes rear-mirror-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.rear-mirror-canvas {
  width: 240px;
  height: 120px;
  border-radius: 8px;
  border: 2px solid rgba(255, 68, 68, 0.8);
  box-shadow: 0 0 20px rgba(255, 68, 68, 0.6);
  background: rgba(0, 0, 0, 0.5);
}

/* ============================================
   円形レーダー
   ============================================ */
.radar {
  position: fixed;
  bottom: 100px;
  left: 24px;
  width: 150px;
  height: 150px;
  pointer-events: none;
  z-index: 30;
}

.radar-minimap {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  z-index: 0;
}

.radar-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(0, 20, 0, 0.5);
  border: 2px solid rgba(100, 255, 100, 0.5);
  overflow: hidden;
  z-index: 1;
}

.radar-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(100, 255, 100, 0.2);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.radar-ring-outer {
  width: 100%;
  height: 100%;
}

.radar-ring-mid {
  width: 66%;
  height: 66%;
}

.radar-ring-inner {
  width: 33%;
  height: 33%;
}

.radar-cross {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
}

.radar-cross::before,
.radar-cross::after {
  content: '';
  position: absolute;
  background: rgba(100, 255, 100, 0.15);
}

.radar-cross::before {
  width: 1px;
  height: 100%;
  left: 50%;
  transform: translateX(-50%);
}

.radar-cross::after {
  width: 100%;
  height: 1px;
  top: 50%;
  transform: translateY(-50%);
}

.radar-north {
  position: absolute;
  width: 20px;
  height: 20px;
  left: 50%;
  top: 50%;
  margin-left: -10px;
  margin-top: -10px;
  color: rgba(255, 200, 100, 0.9);
  font-size: 10px;
  font-weight: bold;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  transform-origin: center center;
  pointer-events: none;
}

.radar-north::before {
  content: 'N';
  position: absolute;
  top: -60px;
}

.radar-player {
  position: absolute;
  width: 8px;
  height: 8px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(100, 200, 255, 1);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(100, 200, 255, 0.8);
  z-index: 2;
}

.radar-player::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 8px solid rgba(100, 200, 255, 1);
  left: 50%;
  top: -10px;
  transform: translateX(-50%);
}

.radar-dots {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  z-index: 1;
}

.radar-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 4px currentColor;
}

.radar-dot-enemy {
  background: #ff4444;
  color: #ff4444;
}

.radar-dot-rival {
  background: #ff8800;
  color: #ff8800;
  width: 10px;
  height: 10px;
  animation: radar-rival-pulse 1s ease-in-out infinite;
}

.radar-dot-mask {
  width: 5px;
  height: 5px;
  animation: radar-mask-pulse 1.5s ease-in-out infinite;
}

.radar-dot-food {
  width: 4px;
  height: 4px;
  opacity: 0.6;
}

.radar-dot-equipment {
  width: 5px;
  height: 5px;
  border-radius: 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

@keyframes radar-rival-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.3); }
}

@keyframes radar-mask-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.radar-range {
  position: absolute;
  bottom: 4px;
  right: 8px;
  font-size: 9px;
  color: rgba(100, 255, 100, 0.7);
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
}

/* 敵ラベル */
.enemy-labels-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
  overflow: hidden;
}

.enemy-label {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -100%);
  pointer-events: none;
  transition: opacity 0.15s;
}

.enemy-label-name {
  font-size: 11px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 4px rgba(0,0,0,0.9), 0 0 8px currentColor;
  white-space: nowrap;
  margin-bottom: 2px;
}

.enemy-label-hp-bar {
  width: 60px;
  height: 6px;
  background: rgba(0,0,0,0.6);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.3);
}

.enemy-label-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #44ff44, #88ff88);
  border-radius: 2px;
  transition: width 0.1s;
}

.enemy-label-hp-fill.hp-mid {
  background: linear-gradient(90deg, #ffff44, #ffff88);
}

.enemy-label-hp-fill.hp-low {
  background: linear-gradient(90deg, #ff4444, #ff8888);
}

.enemy-label-masks {
  display: flex;
  gap: 2px;
  margin-top: 2px;
}

.enemy-label-mask {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: 0 0 4px currentColor;
}

.enemy-label-distance {
  font-size: 9px;
  color: rgba(255,255,255,0.8);
  text-shadow: 0 0 3px rgba(0,0,0,0.9);
  margin-top: 1px;
}

.enemy-label-speed {
  font-size: 9px;
  color: #ff8844;
  font-weight: bold;
  text-shadow: 0 0 3px rgba(0,0,0,0.9);
}

/* モバイル用タッチコントロール */
.touch-controls {
  display: none; /* デスクトップでは非表示 */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  pointer-events: none;
  z-index: 200;
}

/* タッチデバイスで表示 */
@media (pointer: coarse), (max-width: 768px) {
  .touch-controls {
    display: block;
  }
}

.touch-joystick {
  position: absolute;
  bottom: 30px;
  pointer-events: auto;
}

.touch-joystick-left {
  left: 30px;
}

.touch-joystick-right {
  right: 30px;
}

.joystick-base {
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.joystick-stick {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  transition: transform 0.05s;
}

.joystick-label {
  text-align: center;
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}
