@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;600;800&family=Shippori+Mincho:wght@600;800&display=swap');

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

input {
  user-select: text;
  -webkit-user-select: text;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #1a1118;
  font-family: 'Noto Sans JP', sans-serif;
  color: #f7efe2;
  touch-action: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.font-serif-jp {
  font-family: 'Shippori Mincho', serif;
}

.dusk-panel {
  background: linear-gradient(145deg, rgba(36, 22, 28, 0.86), rgba(22, 15, 24, 0.90));
  border: 1px solid rgba(255, 179, 107, 0.28);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 214, 165, 0.14);
  backdrop-filter: blur(10px);
}

.dusk-card {
  background: linear-gradient(160deg, rgba(48, 28, 32, 0.82), rgba(26, 18, 28, 0.88));
  border: 1px solid rgba(255, 179, 107, 0.24);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.dusk-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 179, 107, 0.72);
  box-shadow: 0 14px 32px rgba(255, 118, 56, 0.22);
}

.stage-card {
  background: linear-gradient(160deg, rgba(38, 26, 36, 0.78), rgba(20, 15, 26, 0.88));
  border: 1px solid rgba(255, 179, 107, 0.22);
  transition: all 0.2s ease;
}

.stage-card:hover {
  border-color: rgba(255, 179, 107, 0.55);
}

.stage-card.active {
  background: linear-gradient(160deg, rgba(84, 42, 34, 0.85), rgba(36, 20, 32, 0.92));
  border-color: rgba(255, 196, 125, 0.92);
  box-shadow: 0 0 0 1px rgba(255, 196, 125, 0.35), 0 10px 26px rgba(217, 107, 56, 0.28);
}

.btn-amber {
  background: linear-gradient(135deg, #d96b38 0%, #b5452a 100%);
  border: 1px solid rgba(255, 210, 160, 0.45);
  box-shadow: 0 6px 20px rgba(181, 69, 42, 0.4);
  transition: all 0.2s ease;
}

.btn-amber:hover:not(:disabled) {
  filter: brightness(1.12);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(217, 107, 56, 0.5);
}

.btn-amber:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

@keyframes countPop {
  0% { transform: scale(1.45); opacity: 0.2; }
  35% { transform: scale(1.0); opacity: 1; }
  100% { transform: scale(0.96); opacity: 0.95; }
}

.count-pop {
  animation: countPop 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 20;
}

#crosshair::before,
#crosshair::after {
  content: '';
  position: absolute;
  background: rgba(255, 236, 209, 0.85);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.85);
}

#crosshair::before { top: 11px; left: 3px; width: 18px; height: 2px; }
#crosshair::after { left: 11px; top: 3px; width: 2px; height: 18px; }

.hit-flash { animation: hitPulse 0.22s ease-out; }
@keyframes hitPulse {
  0% { transform: translate(-50%, -50%) scale(1.65); }
  100% { transform: translate(-50%, -50%) scale(1.0); }
}

.dir-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 210px;
  height: 210px;
  margin-left: -105px;
  margin-top: -105px;
  pointer-events: none;
  z-index: 18;
}

.dir-arrow {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 16px solid #ff944d;
  filter: drop-shadow(0 0 8px rgba(255, 148, 77, 0.9));
}

.dir-arrow.hungry {
  border-bottom-color: #ff4242;
  filter: drop-shadow(0 0 12px rgba(255, 66, 66, 0.95));
}

.dir-arrow.fly {
  border-bottom-color: #38bdf8;
  filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.95));
}

#damage-vignette, #poison-vignette, #starve-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

#damage-vignette {
  z-index: 15;
  transition: opacity 0.14s ease-out;
  background: radial-gradient(circle, transparent 52%, rgba(210, 38, 30, 0.65) 100%);
}

#poison-vignette {
  z-index: 14;
  transition: opacity 0.12s ease-out;
  background: radial-gradient(circle, transparent 46%, rgba(108, 194, 78, 0.62) 100%);
}

#starve-vignette {
  z-index: 16;
  background: radial-gradient(circle, transparent 42%, rgba(92, 10, 14, 0.78) 85%, rgba(28, 4, 6, 0.94) 100%);
}

#starve-vignette.pulsing {
  animation: starvePulse 0.85s ease-in-out infinite;
}

@keyframes starvePulse {
  0%, 100% { opacity: 0.48; }
  35% { opacity: 0.92; }
  55% { opacity: 0.62; }
  72% { opacity: 0.88; }
}

@keyframes lowFuelBlink {
  0%, 100% { opacity: 1; box-shadow: 0 0 10px rgba(239, 68, 68, 0.85); }
  50% { opacity: 0.45; box-shadow: 0 0 2px rgba(239, 68, 68, 0.25); }
}

.low-fuel-warning {
  background: linear-gradient(90deg, #dc2626, #f87171) !important;
  animation: lowFuelBlink 0.65s ease-in-out infinite;
}

.low-fuel-text {
  color: #fca5a5 !important;
  animation: lowFuelBlink 0.65s ease-in-out infinite;
}

.no-scrollbar::-webkit-scrollbar { display: none; }

/* スマホ版HUDコンパクト化（4本ゲージでも左スティックと被らない高さ調整） */
body.is-mobile #hud {
  padding: 6px 10px !important;
}
body.is-mobile #hud-top-left {
  padding: 5px 10px !important;
  gap: 8px !important;
}
body.is-mobile #hud-timer-box {
  padding: 4px 12px !important;
  min-width: 96px !important;
}
body.is-mobile #hud-timer {
  font-size: 1.15rem !important;
  line-height: 1.3rem !important;
}
body.is-mobile #hud-status-box {
  padding: 6px 9px !important;
  width: 176px !important;
  margin-bottom: 138px;
}
body.is-mobile #hud-status-box .text-\[11px\] {
  font-size: 9.5px !important;
  line-height: 1.1 !important;
}
body.is-mobile .hud-pc-only,
body.is-mobile #hud-controls-detail-wrap,
body.is-mobile #hud-quick-tip-wrap {
  display: none !important;
}

/* スマホ用タッチ操作UI */
#mobile-controls {
  position: fixed;
  inset: 0;
  z-index: 22;
  pointer-events: none;
}

#joy-zone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 44%;
  height: 54%;
  pointer-events: auto;
  touch-action: none;
}

#joy-base {
  position: absolute;
  left: 24px;
  bottom: 20px;
  width: 110px;
  height: 110px;
  border-radius: 9999px;
  background: rgba(25, 16, 22, 0.42);
  border: 2px solid rgba(255, 195, 130, 0.35);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.35);
}

#joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin-left: -23px;
  margin-top: -23px;
  border-radius: 9999px;
  background: radial-gradient(circle at 35% 35%, rgba(255, 210, 155, 0.9), rgba(210, 102, 52, 0.78));
  border: 2px solid rgba(255, 236, 210, 0.7);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transition: background 0.1s ease;
}

#joy-knob.dash {
  background: radial-gradient(circle at 35% 35%, rgba(255, 240, 160, 0.96), rgba(245, 120, 40, 0.92));
  box-shadow: 0 0 18px rgba(255, 150, 60, 0.75);
}

#look-zone {
  position: absolute;
  right: 0;
  top: 0;
  width: 56%;
  height: 100%;
  pointer-events: auto;
  touch-action: none;
}

.m-act-btn {
  pointer-events: auto;
  touch-action: none;
  border-radius: 9999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff6e8;
  background: rgba(34, 20, 26, 0.68);
  border: 2px solid rgba(255, 185, 115, 0.48);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(4px);
  transition: transform 0.08s ease, background 0.1s ease, box-shadow 0.12s ease;
}

.m-act-btn:active, .m-act-btn.active {
  transform: scale(0.92);
  background: rgba(217, 107, 56, 0.85);
  border-color: rgba(255, 235, 200, 0.9);
}

.m-act-btn.fly-ready {
  border-color: rgba(56, 189, 248, 0.9);
  background: rgba(14, 64, 92, 0.76);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.55);
}

.m-act-btn.flying {
  border-color: rgba(253, 224, 71, 0.98);
  background: rgba(217, 119, 6, 0.92);
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.85);
}
