/* Colours come from theme.js at runtime via the --letterbox custom
   property; this file only lays things out. */
:root {
  --letterbox: #050608;
  color-scheme: dark;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--letterbox);
}

#viewport {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#viewport canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

#hud {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 1.2vh;
  padding-bottom: 4vh;
  pointer-events: none;
  font-family: monospace;
  color: var(--hud-text);
}

.hud-crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border: 2px solid var(--hud-text);
  border-radius: 50%;
  opacity: 0.8;
}

.hud-prompt {
  background: var(--hud-bg);
  padding: 0.5em 1em;
  border-radius: 4px;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.hud-prompt--urgent {
  color: var(--hud-accent);
  font-weight: bold;
  animation: prompt-pulse 0.5s ease-in-out infinite;
}

@keyframes prompt-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

.hud-meter {
  width: 160px;
  height: 10px;
  background: var(--hud-meter-track);
  border-radius: 5px;
  overflow: hidden;
}

.hud-meter-fill {
  width: 100%;
  height: 100%;
  background: var(--hud-accent);
  transform-origin: left;
  transform: scaleX(0);
  transition: box-shadow 0.15s ease;
}

.hud-meter--charged .hud-meter-fill {
  box-shadow: 0 0 8px 2px var(--hud-accent);
}

.hud-reel-bar {
  position: relative;
  width: 22px;
  height: 200px;
  background: var(--reel-track);
  border-radius: 11px;
  transition: box-shadow 0.1s ease;
}

.hud-reel-bar--locked {
  box-shadow: 0 0 12px 2px var(--reel-target);
}

.hud-reel-target {
  position: absolute;
  left: 2px;
  right: 2px;
  background: var(--reel-target);
  border-radius: 4px;
}

.hud-reel-marker {
  position: absolute;
  left: -4px;
  right: -4px;
  height: 4px;
  margin-bottom: -2px;
  background: var(--reel-marker);
  border-radius: 2px;
}

.hud-reel-progress {
  width: 160px;
  height: 6px;
  background: var(--hud-meter-track);
  border-radius: 3px;
  overflow: hidden;
}

.hud-reel-progress-fill {
  width: 100%;
  height: 100%;
  background: var(--reel-target);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.1s ease-out;
}

.hud-catch-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.4em;
  padding: 1.2em 1.6em;
  background: var(--hud-bg);
  border: 2px solid var(--catch-rarity-color, transparent);
  border-radius: 6px;
  text-align: center;
}

.hud-catch-card--pop {
  animation: catch-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes catch-pop {
  0% {
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 0;
  }
  60% {
    transform: translate(-50%, -50%) scale(1.08);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.hud-catch-art {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--placeholder-art);
  border: 2px dashed var(--placeholder-art-border);
  color: var(--placeholder-art-text);
  font-size: 10px;
  font-weight: bold;
}

.hud-catch-name {
  font-size: 16px;
  font-weight: bold;
  color: var(--hud-accent);
}

.hud-catch-rarity {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hud-catch-flavor {
  font-size: 13px;
  max-width: 220px;
}

.hud-catch-stats {
  font-size: 12px;
  color: var(--hud-accent);
}

.hud-catch-record {
  display: none;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.05em;
  color: var(--hud-accent);
  animation: record-pulse 1s ease-in-out infinite;
}

@keyframes record-pulse {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

.hud-catch-hint {
  font-size: 11px;
  opacity: 0.7;
}

.hud-hint {
  position: fixed;
  bottom: 12px;
  left: 12px;
  font-size: 11px;
  opacity: 0.55;
  pointer-events: none;
}

.codex {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  flex-direction: column;
  gap: 1em;
  padding: 4vh 6vw;
  background: var(--codex-bg);
  font-family: monospace;
  color: var(--hud-text);
  overflow-y: auto;
  pointer-events: auto;
}

.codex-header {
  display: flex;
  align-items: center;
  gap: 1em;
}

.codex-title {
  font-size: 20px;
  font-weight: bold;
  color: var(--hud-accent);
}

.codex-count {
  font-size: 12px;
  opacity: 0.7;
}

.codex-close {
  margin-left: auto;
  background: var(--hud-bg);
  color: var(--hud-text);
  border: 1px solid var(--codex-card-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 0.4em 0.7em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.codex-close:hover {
  background: var(--hud-accent);
  color: var(--letterbox);
}

.codex-controls {
  display: flex;
  gap: 0.8em;
}

.codex-search,
.codex-rarity {
  font-family: inherit;
  font-size: 13px;
  padding: 0.4em 0.6em;
  border-radius: 4px;
  border: 1px solid var(--codex-card-border);
  background: var(--hud-bg);
  color: var(--hud-text);
}

.codex-search {
  flex: 1;
  max-width: 260px;
}

.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.8em;
  align-content: start;
}

.codex-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4em;
  padding: 0.8em;
  background: var(--codex-card-bg);
  border: 1px solid var(--codex-card-border);
  border-radius: 6px;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.codex-card:not(.codex-card--locked):hover {
  transform: translateY(-2px);
  border-color: var(--hud-accent);
}

.codex-card--locked {
  opacity: 0.6;
}

.codex-card-art {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--placeholder-art);
  border: 2px dashed var(--placeholder-art-border);
  color: var(--placeholder-art-text);
  font-size: 9px;
  font-weight: bold;
}

.codex-card--locked .codex-card-art {
  background: transparent;
  border-color: var(--codex-card-border);
  color: var(--codex-locked-text);
  font-size: 18px;
}

.codex-card-name {
  font-size: 13px;
  font-weight: bold;
}

.codex-card--locked .codex-card-name {
  color: var(--codex-locked-text);
}

.codex-card-rarity {
  font-size: 10px;
  min-height: 1em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.codex-card-flavor {
  font-size: 11px;
  opacity: 0.8;
}

.codex-card-stats {
  font-size: 10px;
  color: var(--hud-accent);
}
