/* Levos v1 — базовый HUD-скелет. Тема игры переопределяет переменные и стили в theme.css */
:root {
  --levos-bg: #101216;
  --levos-panel: rgba(18, 20, 26, 0.92);
  --levos-panel-light: rgba(255, 255, 255, 0.06);
  --levos-text: #f2f4f8;
  --levos-text-dim: #9aa3b2;
  --levos-accent: #22c55e;
  --levos-danger: #ef4444;
  --levos-radius: 14px;
  --levos-font: "Manrope", system-ui, -apple-system, sans-serif;
  --levos-font-display: "Unbounded", var(--levos-font);
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--levos-bg);
  font-family: var(--levos-font);
  color: var(--levos-text);
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

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

.levos-hud { pointer-events: none; }
.levos-hud button { pointer-events: auto; cursor: pointer; }

/* ---------- верхняя панель (safe-area) ---------- */
.levos-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) calc(12px + env(safe-area-inset-right, 0px)) 8px calc(12px + env(safe-area-inset-left, 0px));
}
.levos-title {
  font-family: var(--levos-font-display);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}
.levos-stats {
  margin-left: auto;
  display: flex;
  gap: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}
.levos-buttons { display: flex; gap: 6px; }
.levos-btn {
  border: 0;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--levos-panel);
  color: var(--levos-text);
  font-size: 16px;
}

/* ---------- hp/xp (combat) ---------- */
.levos-vitals { display: flex; align-items: center; gap: 12px; margin-left: 8px; }
.levos-hpbar {
  width: 180px; height: 14px;
  border-radius: 8px;
  background: rgba(10, 12, 16, 0.75);
  border: 1.5px solid rgba(255,255,255,0.25);
  overflow: hidden;
}
.levos-hpbar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #f87171, #dc2626);
  transition: width 0.15s ease;
}
.levos-hpbar-fill.low { animation: levos-hp-pulse 0.7s ease-in-out infinite; }
@keyframes levos-hp-pulse { 50% { filter: brightness(1.6); } }
.levos-xp {
  display: flex; align-items: center; gap: 5px;
  font-weight: 800; font-variant-numeric: tabular-nums;
  color: #fbbf24; text-shadow: 0 1px 6px rgba(0,0,0,0.6);
  font-size: 14px;
}
@media (max-width: 640px) { .levos-hpbar { width: 110px; } }

/* ---------- подсказка действия ---------- */
.levos-hint {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--levos-panel);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- чек-лист ---------- */
.levos-checklist {
  position: fixed;
  top: calc(56px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  width: 210px;
  max-height: 50vh;
  overflow: auto;
  background: var(--levos-panel);
  border-radius: var(--levos-radius);
  padding: 10px 14px;
}
.levos-checklist h3 {
  margin: 2px 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--levos-text-dim);
}
.levos-checklist ol {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.75;
}
.levos-checklist li.done {
  color: var(--levos-text-dim);
  text-decoration: line-through;
}

/* ---------- тост ---------- */
.levos-toast {
  position: fixed;
  left: 50%;
  top: calc(64px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  background: var(--levos-panel);
  border-left: 3px solid var(--levos-accent);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}

/* ---------- джойстик + кнопка действия (только touch) ---------- */
.levos-joystick, .levos-action-btn { display: none; }
.levos-touch .levos-joystick {
  display: block;
  position: fixed;
  left: calc(22px + env(safe-area-inset-left, 0px));
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  width: 116px; height: 116px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.18);
  pointer-events: auto;
  touch-action: none;
}
.levos-joystick-knob {
  position: absolute;
  left: 50%; top: 50%;
  width: 52px; height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.28);
  border: 1.5px solid rgba(255,255,255,0.4);
}
.levos-touch .levos-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  right: calc(26px + env(safe-area-inset-right, 0px));
  bottom: calc(34px + env(safe-area-inset-bottom, 0px));
  width: 74px; height: 74px;
  border-radius: 50%;
  border: 0;
  background: var(--levos-accent);
  color: #08110b;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  touch-action: none;
}

/* ---------- формы героя ---------- */
.levos-forms {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  pointer-events: auto;
}
.levos-forms[hidden] { display: none; }
.levos-form-btn {
  position: relative;
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  background: var(--levos-panel);
  color: var(--levos-text);
  font-size: 22px;
  touch-action: none;
}
.levos-form-btn.active {
  border-color: var(--levos-accent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--levos-accent) 60%, transparent);
}
.levos-form-key {
  position: absolute;
  right: -2px; top: -2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,0.16);
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.levos-touch .levos-forms { left: auto; right: calc(116px + env(safe-area-inset-right, 0px)); transform: none; bottom: calc(30px + env(safe-area-inset-bottom, 0px)); flex-direction: column; }
.levos-touch .levos-form-btn { width: 48px; height: 48px; font-size: 18px; }
.levos-touch .levos-form-key { display: none; }

/* ---------- выбор сложности ---------- */
.levos-difficulty { margin-top: 14px; }
.levos-difficulty[hidden] { display: none; }
.levos-diff-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--levos-text-dim);
  margin-bottom: 8px;
}
.levos-diff-btns { display: flex; gap: 8px; justify-content: center; }
.levos-diff-btn {
  border: 1.5px solid rgba(255,255,255,0.18);
  background: transparent;
  color: var(--levos-text);
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 700;
}
.levos-diff-btn.active {
  border-color: var(--levos-accent);
  background: color-mix(in srgb, var(--levos-accent) 18%, transparent);
}

/* ---------- модалки ---------- */
.levos-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 14, 0.72);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  z-index: 50;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.levos-modal[hidden] { display: none; }
.levos-modal-box {
  position: relative;
  width: min(440px, calc(100vw - 40px));
  max-height: calc(100dvh - 60px);
  overflow: auto;
  background: var(--levos-panel);
  border: 1px solid var(--levos-panel-light);
  border-radius: 20px;
  padding: 26px;
  text-align: center;
}
.levos-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--levos-accent);
  font-weight: 700;
}
.levos-modal-box h1 {
  font-family: var(--levos-font-display);
  font-size: 26px;
  margin: 10px 0;
}
.levos-modal-box h2 { font-family: var(--levos-font-display); font-size: 20px; margin: 8px 0 12px; }
.levos-hero-art { max-width: 180px; max-height: 180px; margin: 8px auto; display: block; }
.levos-intro-text { color: var(--levos-text-dim); font-size: 14px; line-height: 1.55; }
.levos-controls-hint { font-size: 12.5px; color: var(--levos-text-dim); margin: 12px 0 4px; }

.levos-btn-primary {
  display: inline-block;
  margin-top: 14px;
  border: 0;
  border-radius: 999px;
  background: var(--levos-accent);
  color: #08110b;
  font-size: 15px;
  font-weight: 800;
  padding: 13px 34px;
}
.levos-btn-secondary {
  display: inline-block;
  margin-top: 10px;
  margin-left: 8px;
  border: 1px solid var(--levos-panel-light);
  border-radius: 999px;
  background: transparent;
  color: var(--levos-text);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 26px;
}
.levos-close {
  position: absolute;
  top: 10px; right: 12px;
  border: 0;
  background: transparent;
  color: var(--levos-text-dim);
  font-size: 26px;
  line-height: 1;
}

/* карточка предмета */
.levos-card-box { text-align: left; }
.levos-card-media img, .levos-card-media video {
  width: 100%;
  border-radius: 12px;
  margin: 10px 0;
}
.levos-card-fields { margin: 10px 0 4px; }
.levos-card-fields div { margin-bottom: 9px; }
.levos-card-fields dt {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--levos-text-dim);
  margin-bottom: 2px;
}
.levos-card-fields dd { margin: 0; font-size: 13.5px; line-height: 1.45; }
.levos-card-box .levos-btn-primary { width: 100%; }

.levos-end-stats {
  display: flex;
  justify-content: center;
  gap: 18px;
  font-size: 13px;
  color: var(--levos-text-dim);
  margin-top: 6px;
}

/* ---------- мобильный лендскейп: чек-лист компактнее ---------- */
@media (max-height: 480px) {
  .levos-checklist { max-height: 38vh; width: 180px; font-size: 11px; }
  .levos-modal-box { padding: 18px; }
}
