:root {
  --bg-dark: #070201;
  --panel-bg: rgba(16, 6, 4, 0.66);
  --panel-border: rgba(255, 128, 36, 0.34);
  --text-main: #fff3e2;
  --text-muted: #f2b78a;
  --accent-fire: #ff6a1a;
  --accent-gold: #ffc44d;
  --accent-danger: #ff3b1f;
  --accent-stun: #68d8ff;
  --accent-gojo: #5ce6ff;
  --accent-purple: #c56bff;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#fire-canvas,
#scene-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#fire-canvas {
  z-index: 1;
  pointer-events: none;
}

#scene-canvas {
  z-index: 2;
  cursor: crosshair;
}

#scene-canvas.hover-target {
  cursor: pointer;
}

.hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.hud-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: 12px 16px;
  max-width: 440px;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.58),
    inset 0 1px 0 rgba(255, 200, 140, 0.16);
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.flame-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff2a6 0%, #ff6a1a 60%, #b31900 100%);
  box-shadow: 0 0 10px #ff7b1c, 0 0 20px #ff3b00;
  animation: pulseDot 1.3s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.35); opacity: 1; }
}

.brand-title-row h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 10px rgba(255, 100, 20, 0.45);
}

.state-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}

.state-badge.state-stalk {
  background: rgba(255, 175, 50, 0.18);
  color: #ffd37a;
  border-color: rgba(255, 175, 50, 0.4);
}

.state-badge.state-chase {
  background: rgba(255, 106, 26, 0.22);
  color: #ffb178;
  border-color: rgba(255, 106, 26, 0.5);
}

.state-badge.state-pounce,
.state-badge.state-roar {
  background: rgba(255, 55, 25, 0.3);
  color: #ffd7c7;
  border-color: rgba(255, 90, 50, 0.72);
  box-shadow: 0 0 12px rgba(255, 70, 20, 0.45);
}

.state-badge.state-knockdown,
.state-badge.state-getup {
  background: rgba(104, 216, 255, 0.18);
  color: #a6ebff;
  border-color: rgba(104, 216, 255, 0.45);
}

.hint-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 9px;
  line-height: 1.45;
}

.hint-text strong {
  color: var(--accent-gold);
  font-weight: 700;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 9px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 8px;
  background: rgba(255, 130, 40, 0.1);
  border: 1px solid rgba(255, 130, 40, 0.2);
}

.stat-label {
  font-size: 11px;
  color: #e4a87d;
}

.stat-value {
  font-size: 13.5px;
  font-weight: 800;
  color: #fff2cc;
  font-variant-numeric: tabular-nums;
}

.gauge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 140, 60, 0.16);
}

.gauge-row.is-hidden {
  display: none;
}

.gauge-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #ffd6a6;
  white-space: nowrap;
}

.gauge-label.gojo-tag {
  color: #82ecff;
  text-shadow: 0 0 8px rgba(92, 230, 255, 0.5);
}

.pip-track {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
}

.pip {
  display: block;
  height: 7px;
  flex: 1;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 165, 80, 0.25);
  transition: all 0.2s ease;
}

.pip.is-filled {
  background: linear-gradient(90deg, #4be3ff, #b366ff);
  border-color: rgba(165, 240, 255, 0.85);
  box-shadow: 0 0 10px rgba(92, 230, 255, 0.65);
}

.hp-bar-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(92, 230, 255, 0.35);
  overflow: hidden;
}

.hp-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #42e8ff 0%, #c15bff 65%, #ff2e55 100%);
  box-shadow: 0 0 10px rgba(255, 55, 95, 0.75);
  transition: width 0.16s ease;
}

.gauge-value {
  font-size: 12px;
  font-weight: 800;
  color: #ffe3b0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.gauge-value.gojo-val {
  color: #9df0ff;
}

.hud-controls {
  pointer-events: auto;
}

.audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  border-radius: 999px;
  border: 1px solid rgba(255, 145, 50, 0.45);
  background: rgba(24, 9, 4, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.audio-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 196, 77, 0.8);
  box-shadow: 0 0 18px rgba(255, 110, 25, 0.35);
}

.audio-btn:active {
  transform: scale(0.97);
}

.audio-btn.is-locked {
  border-color: rgba(255, 196, 77, 0.85);
  box-shadow: 0 0 18px rgba(255, 130, 30, 0.45);
  animation: pulseAudio 1.8s ease-in-out infinite;
}

@keyframes pulseAudio {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 120, 20, 0.35); }
  50% { box-shadow: 0 0 24px rgba(255, 170, 50, 0.72); }
}

.audio-btn.is-muted {
  opacity: 0.72;
  border-color: rgba(255, 145, 50, 0.25);
}

.roar-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  opacity: 0.3;
  transition: opacity 0.15s ease;
}

.roar-bars i {
  display: block;
  width: 2.5px;
  height: 4px;
  border-radius: 2px;
  background: var(--accent-gold);
}

.audio-btn.is-roaring .roar-bars {
  opacity: 1;
}

.audio-btn.is-roaring .roar-bars i:nth-child(1) {
  animation: roarBar 0.26s ease-in-out infinite alternate;
}
.audio-btn.is-roaring .roar-bars i:nth-child(2) {
  animation: roarBar 0.2s ease-in-out 0.08s infinite alternate;
}
.audio-btn.is-roaring .roar-bars i:nth-child(3) {
  animation: roarBar 0.24s ease-in-out 0.14s infinite alternate;
}

@keyframes roarBar {
  from { height: 3px; }
  to { height: 13px; }
}

.audio-toast {
  align-self: center;
  background: rgba(20, 8, 4, 0.78);
  border: 1px solid rgba(255, 165, 65, 0.42);
  color: #ffe3b8;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.audio-toast.is-hidden {
  opacity: 0;
  transform: translateY(10px);
}

@media (max-width: 640px) {
  .hud {
    padding: 10px 12px;
  }

  .hud-panel {
    padding: 10px 12px;
  }

  .brand-title-row h1 {
    font-size: 14px;
  }

  .hint-text {
    font-size: 11px;
  }

  .audio-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .audio-toast {
    font-size: 11.5px;
    text-align: center;
  }
}
