/* ==========================================================================
   La Nuit Étoilée aux Chats — Van Gogh 3D Cat Spotting Game
   Impasto Painted UI & HUD Styles
   ========================================================================== */

:root {
  --vg-night-deep: #0b132b;
  --vg-cobalt: #1d3567;
  --vg-ultramarine: #264887;
  --vg-sky-swirl: #456fb5;
  --vg-cyan-glow: #7fa9d8;
  --vg-gold-bright: #ffe169;
  --vg-gold-warm: #f5b841;
  --vg-ochre: #d98a2b;
  --vg-cream: #fdf3d7;
  --vg-cypress: #132620;
  --vg-shadow: rgba(6, 11, 26, 0.82);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--vg-night-deep);
  font-family: 'Georgia', 'Palatino Linotype', 'Book Antiqua', serif;
  color: var(--vg-cream);
}

#game-canvas-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

#game-canvas-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Subtle painted vignette & canvas grain overlay */
#painterly-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(circle at 50% 50%, transparent 62%, rgba(7, 13, 31, 0.55) 100%);
  box-shadow: inset 0 0 80px rgba(5, 10, 24, 0.65);
}

/* ==========================================================================
   TOP HUD BAR (Matches the reference screenshot layout)
   ========================================================================== */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.painted-panel {
  background:
    linear-gradient(135deg, rgba(35, 63, 120, 0.92) 0%, rgba(19, 36, 76, 0.94) 55%, rgba(28, 52, 102, 0.92) 100%);
  border: 2px solid rgba(125, 165, 224, 0.45);
  box-shadow:
    0 6px 20px rgba(4, 9, 22, 0.72),
    inset 0 1px 0 rgba(255, 232, 148, 0.28),
    inset 0 -2px 6px rgba(8, 15, 35, 0.7);
  border-radius: 10px 14px 11px 13px;
  position: relative;
}

.painted-panel::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 8px 12px 9px 11px;
  border: 1px dashed rgba(255, 225, 105, 0.2);
  pointer-events: none;
}

/* --- TOP LEFT: Found Counter & 12 Cat Silhouette Icons --- */
#hud-top-left {
  position: absolute;
  top: 14px;
  left: 16px;
  padding: 8px 14px 10px 14px;
  min-width: 245px;
  pointer-events: auto;
  transition: transform 0.25s ease;
}

#hud-top-left:hover {
  transform: translateY(1px);
}

.counter-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

#cat-counter-text {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--vg-cream);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.85), 0 0 10px rgba(255, 225, 105, 0.35);
  letter-spacing: 0.5px;
}

.journal-hint-label {
  font-size: 0.74rem;
  color: var(--vg-gold-bright);
  opacity: 0.88;
  font-style: italic;
  cursor: pointer;
}

.journal-hint-label:hover {
  text-decoration: underline;
  opacity: 1;
}

#cat-icons-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cat-mini-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.25s ease;
  opacity: 0.38;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

.cat-mini-icon svg {
  width: 100%;
  height: 100%;
  fill: #7f9fd4;
  transition: fill 0.25s ease;
}

.cat-mini-icon.found {
  opacity: 1;
  transform: scale(1.08);
  filter: drop-shadow(0 0 5px rgba(255, 217, 90, 0.8));
}

.cat-mini-icon.found svg {
  fill: var(--vg-gold-bright);
}

.cat-mini-icon:hover {
  transform: scale(1.25);
  opacity: 0.95;
}

/* --- TOP CENTER: Cat Discovery / Clue Banner (Matches "Cyprès" banner) --- */
#hud-top-center {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 22px 9px 14px;
  min-width: 390px;
  max-width: 560px;
  pointer-events: auto;
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

#hud-top-center.hidden-banner {
  opacity: 0;
  transform: translateX(-50%) translateY(-18px) scale(0.96);
  pointer-events: none;
}

#banner-portrait-wrap {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2.5px solid var(--vg-gold-warm);
  background: radial-gradient(circle at 50% 40%, #2a4880, #0d1836);
  box-shadow: 0 0 12px rgba(245, 184, 65, 0.45), inset 0 0 8px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#banner-portrait-canvas {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.banner-content {
  flex: 1;
  text-align: center;
}

.banner-title-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
}

#banner-cat-name {
  font-size: 1.45rem;
  font-style: italic;
  font-weight: bold;
  color: var(--vg-gold-bright);
  text-shadow:
    0 2px 4px rgba(0, 0, 0, 0.9),
    0 0 14px rgba(255, 215, 80, 0.45);
  letter-spacing: 0.5px;
}

#banner-cat-index {
  font-size: 0.95rem;
  color: var(--vg-cream);
  opacity: 0.9;
  font-weight: 600;
}

#banner-cat-clue {
  font-size: 0.84rem;
  font-style: italic;
  color: #dbe8ff;
  margin-top: 2px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

#banner-status-pill {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(255, 225, 105, 0.18);
  border: 1px solid rgba(255, 225, 105, 0.45);
  color: var(--vg-gold-bright);
}

/* --- TOP RIGHT: Moon Timer & Audio / Hint Controls --- */
#hud-top-right {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.timer-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--vg-cream);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.85);
}

.moon-icon {
  color: var(--vg-gold-bright);
  font-size: 1.1rem;
  filter: drop-shadow(0 0 6px rgba(255, 225, 105, 0.7));
}

.hud-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--vg-cream);
  font-size: 1.05rem;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
  position: relative;
}

.hud-icon-btn:hover {
  transform: translateY(-1px) scale(1.04);
  border-color: var(--vg-gold-bright);
}

.hud-icon-btn.muted {
  opacity: 0.55;
}

.hud-icon-btn .key-badge {
  position: absolute;
  bottom: -5px;
  right: -4px;
  background: var(--vg-gold-warm);
  color: #0b132b;
  font-size: 0.62rem;
  font-weight: bold;
  font-family: sans-serif;
  padding: 1px 4px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* ==========================================================================
   CENTER RETICLE (Matches the circular viewfinder in the screenshot)
   ========================================================================== */
#reticle-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#reticle-outer {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(253, 243, 215, 0.72);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.65);
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#reticle-inner {
  width: 5px;
  height: 5px;
  background: rgba(253, 243, 215, 0.85);
  border-radius: 50%;
  transition: all 0.18s ease;
}

#reticle-wrap.cat-aimed #reticle-outer {
  width: 30px;
  height: 30px;
  border-color: var(--vg-gold-bright);
  box-shadow: 0 0 16px rgba(255, 225, 105, 0.9), inset 0 0 8px rgba(255, 225, 105, 0.5);
  transform: scale(1.08);
}

#reticle-wrap.cat-aimed #reticle-inner {
  width: 8px;
  height: 8px;
  background: var(--vg-gold-bright);
  box-shadow: 0 0 10px var(--vg-gold-bright);
}

#reticle-prompt {
  position: absolute;
  top: 38px;
  white-space: nowrap;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--vg-gold-bright);
  background: rgba(11, 19, 43, 0.82);
  border: 1px solid rgba(255, 225, 105, 0.5);
  padding: 3px 10px;
  border-radius: 12px;
  text-shadow: 0 1px 3px #000;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#reticle-wrap.cat-aimed #reticle-prompt {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   WARM PROXIMITY / COMPASS WHISPER BAR (Bottom Center)
   ========================================================================== */
#hud-bottom-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

#proximity-whisper {
  padding: 6px 16px;
  font-size: 0.88rem;
  font-style: italic;
  color: var(--vg-gold-bright);
  background: rgba(13, 24, 54, 0.82);
  border: 1px solid rgba(255, 225, 105, 0.35);
  border-radius: 18px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#proximity-whisper.visible {
  opacity: 1;
  transform: translateY(0);
}

#controls-hint-bar {
  font-size: 0.78rem;
  color: rgba(253, 243, 215, 0.78);
  background: rgba(10, 18, 40, 0.68);
  padding: 5px 14px;
  border-radius: 14px;
  border: 1px solid rgba(127, 169, 216, 0.25);
  letter-spacing: 0.3px;
}

#controls-hint-bar kbd {
  background: rgba(255, 225, 105, 0.16);
  border: 1px solid rgba(255, 225, 105, 0.4);
  color: var(--vg-gold-bright);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 0.74rem;
  margin: 0 2px;
}

/* ==========================================================================
   CAT JOURNAL / CLUE BOOK DRAWER (Toggle with H or clicking Top-Left Panel)
   ========================================================================== */
#journal-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(6, 11, 26, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.25s ease;
}

#journal-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.journal-card {
  width: min(860px, 92vw);
  max-height: 84vh;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.journal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 225, 105, 0.3);
  padding-bottom: 12px;
}

.journal-header h2 {
  font-size: 1.55rem;
  color: var(--vg-gold-bright);
  font-style: italic;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

.journal-close-btn {
  background: rgba(255, 225, 105, 0.15);
  border: 1px solid var(--vg-gold-warm);
  color: var(--vg-cream);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}

.journal-close-btn:hover {
  background: rgba(255, 225, 105, 0.3);
}

#journal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 12px;
}

.journal-cat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(12, 23, 52, 0.75);
  border: 1px solid rgba(127, 169, 216, 0.3);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.2s ease;
}

.journal-cat-item:hover {
  transform: translateY(-2px);
  border-color: var(--vg-gold-bright);
}

.journal-cat-item.found {
  background: linear-gradient(135deg, rgba(44, 77, 140, 0.82), rgba(24, 45, 92, 0.88));
  border-color: var(--vg-gold-warm);
}

.journal-cat-thumb {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid rgba(255, 225, 105, 0.5);
  flex-shrink: 0;
  background: #0d1836;
}

.journal-cat-info h4 {
  font-size: 1.02rem;
  color: var(--vg-gold-bright);
  font-style: italic;
}

.journal-cat-info p {
  font-size: 0.78rem;
  color: #cfdff7;
  font-style: italic;
  margin-top: 2px;
}

.journal-cat-status {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #9ab6e0;
}

.journal-cat-item.found .journal-cat-status {
  background: rgba(255, 225, 105, 0.22);
  color: var(--vg-gold-bright);
}

/* ==========================================================================
   INTRO TITLE OVERLAY & VICTORY CELEBRATION MODAL
   ========================================================================== */
.fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: radial-gradient(circle at 50% 45%, rgba(18, 34, 74, 0.68) 0%, rgba(7, 13, 30, 0.9) 100%);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.45s ease;
}

.fullscreen-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-card {
  width: min(580px, 90vw);
  padding: 34px 36px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.overlay-subtitle-top {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--vg-gold-warm);
}

.overlay-title {
  font-size: 2.35rem;
  font-style: italic;
  color: var(--vg-gold-bright);
  text-shadow:
    0 3px 10px rgba(0, 0, 0, 0.9),
    0 0 24px rgba(255, 215, 80, 0.45);
  line-height: 1.15;
}

.overlay-desc {
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--vg-cream);
  opacity: 0.92;
  max-width: 460px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 18px;
  text-align: left;
  background: rgba(9, 17, 39, 0.65);
  padding: 14px 20px;
  border-radius: 10px;
  border: 1px solid rgba(127, 169, 216, 0.3);
  width: 100%;
  font-size: 0.88rem;
}

.controls-grid div strong {
  color: var(--vg-gold-bright);
}

.primary-painted-btn {
  margin-top: 6px;
  padding: 13px 32px;
  font-size: 1.15rem;
  font-family: inherit;
  font-weight: bold;
  font-style: italic;
  color: #0b132b;
  background: linear-gradient(135deg, #ffe57f 0%, #f5b033 100%);
  border: 2px solid #fff1b5;
  border-radius: 26px;
  cursor: pointer;
  box-shadow:
    0 6px 20px rgba(245, 176, 51, 0.5),
    inset 0 2px 2px rgba(255, 255, 255, 0.7);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-painted-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 8px 26px rgba(255, 225, 105, 0.75),
    inset 0 2px 3px rgba(255, 255, 255, 0.9);
}

@media (max-width: 760px) {
  #hud-top-center {
    top: 76px;
    min-width: 300px;
  }
  .controls-grid {
    grid-template-columns: 1fr;
  }
}
