/* ═══════════════════════════════════════════════════
   HAVEN — прототип мини-игры
═══════════════════════════════════════════════════ */

.haven-tab-screen {
  padding: 0 !important;
  overflow: hidden !important;
  background: #0b0714;
}

/* Скрываем нижнюю панель навигации на время игры — больше места под сцену */
body.haven-active .nav-wrap {
  display: none !important;
}

.haven-game-wrap {
  position: absolute;
  inset: 0;
  background: #0b0714;
  overflow: hidden;
}

#haven-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.haven-exit-btn {
  position: absolute;
  top: 14px; left: 14px;
  z-index: 5;
  background: rgba(11,7,20,.7);
  border: 1px solid rgba(111,233,255,.35);
  color: #eaf6ff;
  font-family: var(--ld-font-ui);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--ld-r-pill);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ── HUD экономики ── */
.haven-hud {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(11,7,20,.7);
  border: 1px solid rgba(111,233,255,.35);
  border-radius: var(--ld-r-pill);
  padding: 8px 10px;
  font-family: var(--ld-font-ui);
  font-size: 12px;
  font-weight: 700;
  color: #eaf6ff;
}
.haven-hud-row { white-space: nowrap; }
.haven-hud-collect {
  background: rgba(95,242,255,.15);
  border: 1px solid rgba(95,242,255,.5);
  color: #5ff2ff;
  font-family: var(--ld-font-ui);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: var(--ld-r-pill);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.haven-hint {
  position: absolute;
  left: 0; right: 0; bottom: 148px;
  z-index: 4;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.haven-hint {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  letter-spacing: 1px;
  color: #5ff2ff;
  background: rgba(11, 7, 20, 0.65);
  border: 1px solid rgba(95, 242, 255, 0.35);
  border-radius: 999px;
  padding: 9px 18px;
  text-shadow: 0 0 8px rgba(95, 242, 255, 0.8);
  text-align: center;
  animation: havenHintPulse 2.4s ease-in-out infinite;
  transition: opacity 1s ease;
}
@keyframes havenHintPulse { 0%, 100% { opacity: 0.85; } 50% { opacity: 0.4; } }

/* ── Плашка "Расчистить завал" ── */
.haven-clear-prompt {
  position: absolute;
  left: 50%; bottom: 190px;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.haven-clear-prompt-name {
  font-family: var(--ld-font-ui);
  font-weight: 800;
  font-size: 12px;
  color: #FFD2A0;
  text-shadow: 0 0 8px rgba(255, 154, 61, 0.6);
  white-space: nowrap;
}
.haven-clear-prompt-btn {
  animation: havenClearPillPulse 1.4s ease-in-out infinite;
  background: linear-gradient(135deg, #FF9A3D, #FF6A1A);
  color: #2a1400;
  font-family: var(--ld-font-display);
  font-weight: 800;
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0.03em;
  padding: 11px 22px;
  border: none;
  border-radius: var(--ld-r-pill);
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
@keyframes havenClearPillPulse {
  0%, 100% { box-shadow: 0 0 14px rgba(255, 153, 60, 0.35); }
  50%      { box-shadow: 0 0 26px rgba(255, 153, 60, 0.6); }
}

/* ── Виртуальный джойстик ── */
.haven-joystick {
  position: absolute;
  left: 50%; right: auto;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  margin: 0;
  transform: translateX(-50%);
  z-index: 6;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: rgba(11, 7, 20, 0.55);
  border: 1px solid rgba(95, 242, 255, 0.35);
  box-shadow: 0 0 24px rgba(95, 242, 255, 0.12), inset 0 0 20px rgba(95, 242, 255, 0.06);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.haven-joystick-knob {
  position: absolute;
  top: 50%; left: 50%;
  width: 46px; height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: rgba(95, 242, 255, 0.18);
  border: 1px solid rgba(95, 242, 255, 0.6);
  box-shadow: 0 0 14px rgba(95, 242, 255, 0.4);
  pointer-events: none;
  transition: transform .05s linear;
}

/* ── Диалог ── */
.haven-dialogue-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 9;
  padding: 14px;
  display: flex;
  justify-content: center;
}
.haven-dialogue-box {
  width: 100%;
  max-width: 480px;
  background: rgba(11, 7, 20, 0.92);
  border: 1px solid rgba(95, 242, 255, 0.4);
  border-radius: 12px;
  box-shadow: 0 0 30px rgba(95, 242, 255, 0.15), 0 8px 30px rgba(0,0,0,.5);
  padding: 16px 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.haven-dialogue-name {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #5ff2ff;
  text-shadow: 0 0 8px rgba(95, 242, 255, 0.7);
  margin-bottom: 8px;
}
.haven-dialogue-text {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
  color: #eaf6ff;
  min-height: 42px;
}
.haven-dialogue-next {
  margin-top: 10px;
  text-align: right;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  color: rgba(95, 242, 255, 0.55);
  animation: havenHintPulse 1.6s ease-in-out infinite;
}

/* ── Терминал (заглушка) ── */
.haven-terminal-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 3, 12, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.haven-terminal-box {
  width: 340px;
  max-width: calc(100vw - 48px);
  background: #0e0b1e;
  border: 1px solid rgba(95, 242, 255, 0.5);
  border-radius: 10px;
  box-shadow: 0 0 40px rgba(95, 242, 255, 0.25), inset 0 0 60px rgba(95, 242, 255, 0.05);
  padding: 22px;
  font-family: 'Courier New', monospace;
  color: #5ff2ff;
}
.haven-terminal-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
  font-size: 14px; letter-spacing: 2px;
  text-shadow: 0 0 8px rgba(95, 242, 255, 0.8);
}
.haven-terminal-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #ff3b30; box-shadow: 0 0 10px #ff3b30;
  display: inline-block;
}
.haven-terminal-body {
  border-top: 1px solid rgba(95, 242, 255, 0.25);
  padding: 16px 0;
  font-size: 12px; line-height: 1.8;
  color: rgba(95, 242, 255, 0.75);
}
.haven-terminal-close {
  width: 100%;
  margin-top: 16px;
  padding-top: 16px;
  border: none;
  border-top: 1px solid rgba(95, 242, 255, 0.25);
  background: none;
  font-family: 'Courier New', monospace;
  font-size: 13px; letter-spacing: 1.5px;
  color: #5ff2ff;
  cursor: pointer;
}
.haven-terminal-close::before {
  content: '';
}

/* ── Предупреждение при входе ── */
.haven-warning-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4,3,10,.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity .2s ease, visibility .2s ease;
}
.haven-warning-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.haven-warning-box {
  width: 100%;
  max-width: 320px;
  background: #12101c;
  border: 1px solid rgba(111,233,255,.28);
  border-radius: var(--ld-r-card);
  box-shadow: var(--ld-shadow-soft);
  padding: 24px 20px 20px;
  text-align: center;
}
.haven-warning-icon { font-size: 40px; margin-bottom: 10px; }
.haven-warning-title {
  font-family: var(--ld-font-display);
  font-size: 17px;
  color: #fff;
  margin-bottom: 8px;
}
.haven-warning-text {
  font-family: var(--ld-font-ui);
  font-size: 13px;
  line-height: 1.4;
  color: var(--ld-text-2);
  margin-bottom: 16px;
}

/* ── Haven v2: склад, задание, терминал управления ── */
.haven-crystal { color: #A98BFF; text-shadow: 0 0 8px rgba(169,139,255,.7); }
.haven-hud-store {
  width: 46px; height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
}
.haven-hud-store-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #5FF5DF, #A98BFF);
  transition: width .4s ease;
}
.haven-hud-menu { padding: 6px 9px; }

.haven-quest {
  position: absolute;
  top: 62px; left: 14px; right: 14px;
  z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px;
  background: rgba(11,7,20,.78);
  border: 1px solid rgba(169,139,255,.45);
  border-radius: 14px;
  font-family: var(--ld-font-ui);
  font-size: 12px; font-weight: 700;
  color: #eaf6ff;
}
.haven-quest-text { min-width: 0; }
.haven-quest-btn {
  flex-shrink: 0;
  min-height: 34px;
  padding: 6px 12px;
  border: none; border-radius: 999px;
  background: var(--ld-gold, linear-gradient(135deg, #FFD75A, #FFB200));
  color: var(--ld-on-gold, #2a1c00);
  font-family: var(--ld-font-ui);
  font-size: 11px; font-weight: 800;
  cursor: pointer;
}

.haven-terminal-body { max-height: 60vh; overflow-y: auto; }
.haven-t-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(95,242,255,.18);
}
.haven-t-row:last-child { border-bottom: none; }
.haven-t-label { font-size: 11px; letter-spacing: .08em; color: rgba(95,242,255,.75); margin-bottom: 3px; }
.haven-t-val { font-size: 13px; color: #eaf6ff; line-height: 1.35; }
.haven-t-hint { margin-top: 4px; font-size: 11px; color: rgba(234,246,255,.55); }
.haven-t-btn {
  flex-shrink: 0;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(95,242,255,.5);
  background: rgba(95,242,255,.12);
  color: #5ff2ff;
  font-family: var(--ld-font-ui);
  font-size: 11px; font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.haven-t-btn.gold {
  border: none;
  background: var(--ld-gold, linear-gradient(135deg, #FFD75A, #FFB200));
  color: var(--ld-on-gold, #2a1c00);
}

/* ── Haven: бета-плашка и плашка у закрытой двери ── */
.haven-beta-tag {
  position: absolute;
  left: 14px; top: 112px;
  z-index: 5;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(214,170,40,.18);
  border: 1px solid rgba(214,170,40,.55);
  color: #ffd166;
  font-family: var(--ld-font-ui);
  font-size: 10px; font-weight: 800; letter-spacing: .04em;
  pointer-events: none;
}
.haven-clear-prompt { width: calc(100% - 32px); max-width: 420px; }
.haven-clear-prompt-btn { white-space: normal; text-align: center; max-width: 100%; line-height: 1.25; }
.haven-clear-prompt-btn:disabled {
  animation: none; cursor: default;
  background: rgba(30,28,36,.9); color: #ffd2a0;
  border: 1px solid rgba(255,154,61,.45);
  font-family: var(--ld-font-ui); font-style: normal; font-size: 12px;
}
.haven-t-beta {
  margin-bottom: 8px; padding: 8px 10px;
  border: 1px dashed rgba(255,209,102,.5); border-radius: 10px;
  color: #ffd166; font-size: 11px; line-height: 1.4;
}
