/*
 * cv-game.css
 * Immersive retro styling, glassmorphism, CRT overlay, and responsive layouts.
 */

:root {
  --accent: #ff7024;
  --accent-glow: rgba(255, 112, 36, 0.4);
  --bg-dark: #0a0c10;
  --glass-bg: rgba(13, 17, 23, 0.85);
  --glass-border: rgba(255, 112, 36, 0.3);
  --font-pixel: 'Press Start 2P', monospace;
  --font-ui: 'Outfit', sans-serif;
  --font-code: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
}

body {
  color: #e2e8f0;
  font-family: var(--font-ui);
}

#game-container {
  position: relative;
  width: 100dvw;
  height: 100dvh;
  overflow: hidden;
  background: #050608;
}

/* --- CRT Retro Screen Simulation --- */
.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.4) 100%);
  pointer-events: none;
  z-index: 10;
}

.scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 4px;
  pointer-events: none;
  z-index: 11;
  opacity: 0.8;
}

/* --- Layout & Canvas --- */
#canvas-container {
  width: 100%;
  height: 100%;
  position: relative;
  background-color: #050608;
  z-index: 1;
}

#game-wrapper {
  position: relative;
  display: block;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
  background-color: #0b0c10;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background-color: #0b0c10;
}

.game-title {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow);
  letter-spacing: 1px;
  z-index: 5;
  white-space: nowrap;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 8px 16px;
}

/* --- Controls Legend Box --- */
.legend-panel {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  padding: 14px 18px;
  border-radius: 8px;
  z-index: 5;
  pointer-events: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-title {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--accent);
  margin-bottom: 4px;
}

.legend-row {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.key {
  background: #2b303a;
  border-bottom: 3px solid #1a1c22;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-code);
  font-size: 11px;
  min-width: 22px;
  text-align: center;
  display: inline-block;
  color: #fff;
}

/* --- Dialogue Box Overlay --- */
#dialogue-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100dvw;
  height: 100dvh;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.dialogue-hidden {
  opacity: 0;
  pointer-events: none;
}

.dialogue-visible {
  opacity: 1;
  pointer-events: auto;
}

.dialogue-backdrop {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

.dialogue-box {
  position: relative;
  background: rgba(13, 17, 23, 0.95);
  border: 3px solid var(--accent);
  border-radius: 12px;
  width: 90%;
  max-width: 550px;
  max-height: 95dvh;
  box-shadow: 0 0 35px var(--accent-glow);
  display: flex;
  flex-direction: column;
  padding: 20px;
  animation: zoomIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 21;
  min-height: 0;
  overflow: hidden;
}

@keyframes zoomIn {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.dialogue-header {
  display: flex;
  flex-shrink: 0;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--accent);
  border-bottom: 2px dashed rgba(255, 112, 36, 0.3);
  padding-bottom: 12px;
  margin-bottom: 8px;
}

.dialogue-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  border-radius: 50%;
}

#dialogue-tech {
  font-family: var(--font-code);
  font-size: 11px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 14px;
  align-self: flex-start;
}

#dialogue-text {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: #cbd5e1;
  scrollbar-width: none; /* Hide standard scrolls */
}

#dialogue-text::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari */
}

#dialogue-text h3 {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: #fff;
  margin-top: 14px;
  margin-bottom: 8px;
}

#dialogue-text p {
  margin-bottom: 10px;
}

#dialogue-text ul {
  margin-left: 20px;
  margin-bottom: 12px;
}

#dialogue-text li {
  margin-bottom: 6px;
}

#dialogue-text a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(255, 112, 36, 0.4);
  transition: color 0.15s;
}

#dialogue-text a:hover {
  color: #ff944d;
}

#dialogue-text hr {
  border: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  margin: 14px 0;
}

/* --- Dialogue Controls Area (ScrollButtons & Exit) --- */
.dialogue-controls {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 10px;
  border-top: 2px dashed rgba(255, 112, 36, 0.3);
  padding-top: 14px;
  margin-top: 10px;
}

.dialogue-btn {
  font-family: var(--font-pixel);
  font-size: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed var(--accent);
  color: #fff;
  padding: 12px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dialogue-btn:hover {
  background: rgba(255, 112, 36, 0.15);
  box-shadow: 0 0 10px rgba(255, 112, 36, 0.2);
}

.dialogue-btn:active {
  transform: scale(0.96);
}

.btn-exit {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #fca5a5;
}

.btn-exit:hover {
  background: #ef4444;
  color: #fff;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* --- Mobile View Enhancements --- */
@media (max-width: 600px) {
  .btn-hub {
    padding: 8px 12px;
    font-size: 9px;
  }

  .game-title {
    display: none;
  }

  .legend-panel {
    bottom: 50px;
    left: 10px;
    padding: 8px 12px;
  }

  .dialogue-box {
    height: auto;
    max-height: 90dvh;
  }

  .dialogue-controls {
    grid-template-columns: 1fr;
  }
}

/* --- Pause Menu & Music Player Modal --- */
#pause-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100dvw;
  height: 100dvh;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

#hire-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100dvw;
  height: 100dvh;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pause-box {
  max-width: 400px;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.pause-content {
  flex: 1;
  min-height: 0;
  overflow-y: visible;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.music-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.music-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  padding: 10px 12px;
}

.music-label {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--accent);
  letter-spacing: 0.5px;
}

/* Custom Select Dropdown in Retro style */
.custom-select {
  position: relative;
  width: 100%;
  font-family: var(--font-pixel);
  font-size: 10px;
  user-select: none;
}

.custom-select-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  padding: 10px 14px;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.custom-select-trigger:hover {
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.custom-select-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: rgba(13, 17, 23, 0.95);
  border: 1px solid var(--accent);
  border-radius: 6px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.8);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-10px);
  transition: all 0.2s cubic-bezier(0.19, 1, 0.22, 1);
  z-index: 100;
  max-height: 122px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) rgba(0, 0, 0, 0.3);
}

/* Scrollbar styling for options list */
.custom-select-options::-webkit-scrollbar {
  width: 6px;
}
.custom-select-options::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}
.custom-select-options::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

.custom-select.open .custom-select-options {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.custom-option {
  padding: 8px 14px;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.custom-option:hover {
  background: var(--accent);
  color: #fff;
}

.music-controls {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

.transport-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  width: 100%;
}

.transport-btn {
  width: 40px;
  height: 40px;
  font-size: 16px !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px !important;
  transition: all 0.15s ease;
}

.transport-btn:hover {
  background: rgba(255, 112, 36, 0.2) !important;
  box-shadow: 0 0 12px rgba(255, 112, 36, 0.3);
  transform: translateY(-1px);
}

.transport-btn:active {
  transform: scale(0.93);
}

#game-music-repeat.active {
  color: var(--accent) !important;
  background: rgba(255, 112, 36, 0.2) !important;
  box-shadow: 0 0 8px rgba(255, 112, 36, 0.3);
}

#game-music-repeat.repeat-one {
  position: relative;
}

#game-music-repeat.repeat-one::after {
  content: '1';
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 8px;
  font-weight: 700;
  color: var(--accent);
  font-family: sans-serif;
}

#game-music-playpause.playing {
  background: rgba(34, 197, 94, 0.2) !important;
  border-color: #22c55e !important;
  color: #86efac !important;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.pause-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: stretch;
}

#btn-fullscreen {
  flex: 0 0 auto;
  font-size: 10px;
  padding: 10px 10px;
}

#btn-fullscreen:hover {
  background: rgba(255, 112, 36, 0.2) !important;
  box-shadow: 0 0 10px rgba(255, 112, 36, 0.2);
}

.pause-hub-btn {
  flex: 1;
  text-align: center;
  padding: 10px 10px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#btn-resume-game {
  padding: 10px 10px;
  flex: 1;
}

.pause-hub-btn:hover {
  background: rgba(255, 112, 36, 0.15) !important;
  box-shadow: 0 0 10px rgba(255, 112, 36, 0.2);
}

.btn-resume-game {
  flex: 1;
  background: rgba(34, 197, 94, 0.15) !important;
  border-color: #22c55e !important;
  color: #86efac !important;
}

.btn-resume-game:hover {
  background: #22c55e !important;
  color: #fff !important;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.4) !important;
}

@media (max-width: 600px) {
  .pause-box {
    width: 95%;
    max-width: 320px;
    padding: 15px;
  }

  .pause-actions {
    flex-direction: column;
    gap: 8px;
  }

  .pause-hub-btn,
  .btn-resume-game {
    width: 100%;
  }
}

/* Compact pause layout: two-column when usable height < 420px */
.pause-box.compact-pause {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
  gap: 6px 10px;
  overflow: visible;
  max-width: 550px;
  width: min(calc(90% + 150px), 96vw) !important;
  max-height: none !important;
  padding: 12px !important;
}

.pause-box.compact-pause .dialogue-header {
  grid-column: 1 / -1;
  margin-bottom: 0;
  padding-bottom: 6px;
}

.pause-box.compact-pause .pause-content {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
}

.pause-box.compact-pause .pause-actions {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  justify-content: center;
  align-items: stretch;
  gap: 5px;
  border-left: 2px dashed rgba(255, 112, 36, 0.3);
  padding-left: 10px;
}

.pause-box.compact-pause .pause-actions .dialogue-btn {
  padding: 6px 8px;
  font-size: 8px;
  white-space: nowrap;
  width: auto !important;
}

/* Volume control & slider styling */
.volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px dashed var(--accent);
}

.volume-label {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: #94a3b8;
  white-space: nowrap;
}

.volume-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--accent) var(--volume-pct, 50%),
    rgba(255, 255, 255, 0.15) var(--volume-pct, 50%)
  );
  outline: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.volume-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 5px;
  cursor: pointer;
  border-radius: 3px;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  cursor: pointer;
  margin-top: -5.5px;
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 16px var(--accent-glow);
}

.volume-slider::-moz-range-track {
  width: 100%;
  height: 5px;
  cursor: pointer;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
}

.volume-slider::-moz-range-progress {
  height: 5px;
  border-radius: 3px;
  background: var(--accent);
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px var(--accent-glow);
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease;
}

.volume-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* Track time seek row */
.track-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
}
.track-time-label {
  font-family: var(--font-code);
  font-size: 10px;
  color: #94a3b8;
  min-width: 36px;
  text-align: center;
  letter-spacing: 0.5px;
} /* Game seek slider - same modern design as standalone */
#track-seek {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--accent) var(--seek-pct, 0%),
    rgba(255, 255, 255, 0.15) var(--seek-pct, 0%)
  );
  outline: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
#track-seek::-webkit-slider-runnable-track {
  width: 100%;
  height: 5px;
  cursor: pointer;
  border-radius: 3px;
}
#track-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  cursor: pointer;
  margin-top: -5.5px;
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease;
}
#track-seek::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 16px var(--accent-glow);
}
#track-seek::-moz-range-track {
  width: 100%;
  height: 5px;
  cursor: pointer;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
}
#track-seek::-moz-range-progress {
  height: 5px;
  border-radius: 3px;
  background: var(--accent);
}
#track-seek::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px var(--accent-glow);
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease;
}
#track-seek::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* Start Screen Modal */
#start-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100dvw;
  height: 100dvh;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.start-box {
  max-width: 450px;
  height: auto;
  gap: 16px;
}

.start-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0;
}

.start-description {
  font-size: 14px;
  line-height: 1.5;
  color: #cbd5e1;
  text-align: center;
  padding: 0 6px;
}

.start-controls-note {
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}

.start-fullscreen-hint {
  text-align: center;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: #94a3b8;
  margin: 4px 0 5px;
  opacity: 0.8;
}

.start-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  border-top: 2px dashed rgba(255, 112, 36, 0.3);
  padding-top: 14px;
}

.start-game-btn {
  flex: 1;
  background: rgba(34, 197, 94, 0.15) !important;
  border-color: #22c55e !important;
  color: #86efac !important;
  padding: 14px 10px !important;
  font-size: 11px !important;
}

.start-game-btn:hover {
  background: #22c55e !important;
  color: #fff !important;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.4) !important;
}

.start-hub-btn {
  flex: 0 0 auto;
  text-decoration: none;
  padding: 14px 16px !important;
  font-size: 11px !important;
}

.start-hub-btn:hover {
  background: rgba(255, 112, 36, 0.15) !important;
  box-shadow: 0 0 10px rgba(255, 112, 36, 0.2);
}

/* Game Over Screen Modal */
#game-over-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100dvw;
  height: 100dvh;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.gameover-box {
  max-width: 380px;
  height: auto;
  gap: 20px;
  border-color: #ef4444 !important;
  box-shadow: 0 0 35px rgba(239, 68, 68, 0.3) !important;
}

.gameover-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
}

.gameover-message {
  font-family: var(--font-pixel);
  font-size: 14px;
  color: #fca5a5;
  text-align: center;
  line-height: 1.8;
}

.gameover-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  border-top: 2px dashed rgba(239, 68, 68, 0.3);
  padding-top: 14px;
}

.restart-btn {
  flex: 1;
  background: rgba(34, 197, 94, 0.15) !important;
  border-color: #22c55e !important;
  color: #86efac !important;
  padding: 14px 10px !important;
  font-size: 11px !important;
}

.restart-btn:hover {
  background: #22c55e !important;
  color: #fff !important;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.4) !important;
}

.gameover-hub-btn {
  flex: 0 0 auto;
  text-decoration: none;
  padding: 14px 16px !important;
  font-size: 11px !important;
}

.gameover-hub-btn:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

@media (max-width: 600px) {
  .start-box,
  .gameover-box {
    width: 90%;
    max-width: 320px;
    padding: 15px;
  }

  .start-actions,
  .gameover-actions {
    flex-direction: column;
    gap: 8px;
  }

  .start-hub-btn,
  .gameover-hub-btn {
    width: 100%;
  }

  .start-description {
    font-size: 12px;
  }
}

/* --- Mobile touch controls --- */
#mobile-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}
#mobile-controls.mobile-visible {
  pointer-events: auto;
}
#joystick-zone {
  position: absolute;
  left: calc(5% + 35px);
  bottom: calc(5% + 25px);
  width: min(33dvw, 33dvh, 180px);
  aspect-ratio: 1;
}
#attack-btn {
  position: absolute;
  right: 8%;
  bottom: 10%;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 112, 36, 0.2);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
#attack-btn:active {
  transform: scale(0.9);
  background: rgba(255, 112, 36, 0.5);
}

/* --- Top-right buttons (mobile) --- */
#pause-btn,
#info-btn {
  position: absolute;
  top: 10px;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
#pause-btn img,
#info-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
#pause-btn {
  right: 10px;
}
#info-btn {
  right: 52px;
}

/* Meet + Hire buttons — desktop + mobile */
#meet-game-btn,
#hire-btn {
  position: absolute;
  top: 13px;
  z-index: 7;
  font-family: var(--font-pixel);
  font-size: 10px;
  background: var(--glass-bg);
  border-radius: 6px;
  padding: 0 10px;
  height: 30px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  transition:
    border-color 0.15s,
    transform 0.1s;
  line-height: 1;
}
#hire-btn {
  right: 94px;
  color: var(--accent);
  border: 1px solid var(--accent);
}
#hire-btn:hover {
  border-color: #ff944d;
}
#hire-btn:active {
  transform: scale(0.93);
}

#meet-game-btn {
  right: 190px;
  color: #49cc90;
  border: 1px solid #49cc90;
}
#meet-game-btn:hover {
  border-color: #6fe0a8;
}
#meet-game-btn:active {
  transform: scale(0.93);
}

/* Hire modal inside game */
.hire-dialog-game {
  max-width: 360px !important;
}
/* Center the Cloudflare Turnstile box on both game forms (cv-index.css is not
   loaded here, so the shared .bk-turnstile/.hire-turnstile rule is repeated). */
.bk-turnstile,
.hire-turnstile {
  margin: 10px 0;
  min-height: 65px;
  display: flex;
  justify-content: center;
}
.hire-dialog-game form {
  display: flex;
  flex-direction: column;
}
.hire-dialog-game .hire-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.hire-dialog-game label {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: #94a3b8;
  letter-spacing: 0.5px;
}
.hire-dialog-game input,
.hire-dialog-game textarea {
  font-family: var(--font-pixel);
  font-size: 9px;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 112, 36, 0.3);
  background: rgba(13, 17, 23, 0.85);
  color: #e2e8f0;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.hire-dialog-game input:focus,
.hire-dialog-game textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(255, 112, 36, 0.3);
}
.hire-dialog-game textarea {
  resize: vertical;
  min-height: 60px;
}
#hire-game-form {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hire-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: auto;
  padding-top: 10px;
}
.hire-dialog-game .cv-success-hidden,
.hire-dialog-game .cv-error-hidden {
  display: none;
  font-family: var(--font-pixel);
  font-size: 9px;
  padding: 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.hire-dialog-game .cv-success-hidden {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}
.hire-dialog-game .cv-error-hidden {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}
#pause-btn:active img,
#info-btn:active img {
  transform: scale(0.85);
}

/* --- Credits modal (mobile) --- */
#credits-modal {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}
#credits-modal.mobile-visible {
  opacity: 1;
  pointer-events: auto;
}
#credits-modal:not(.mobile-visible) {
  opacity: 0;
  pointer-events: none;
}
.credits-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}
.credits-modal-box {
  position: relative;
  background: var(--glass-bg);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 24px;
  max-width: 320px;
  width: 85%;
  max-height: 80dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 0 30px var(--accent-glow);
  z-index: 41;
}
.credits-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--accent);
  margin-bottom: 16px;
}
#credits-close {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.credits-modal-body {
  font-size: 13px;
  line-height: 1.8;
  color: #cbd5e1;
}
.credits-modal-body a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}
.credits-modal-body a:hover {
  text-decoration: underline;
}
.credits-modal-body p {
  margin: 8px 0;
}

/* --- Desktop tech boxes --- */
.tech-boxes {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 5;
}
.tech-box {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 10px;
  text-align: center;
  color: #94a3b8;
  text-decoration: none;
  transition: all 0.15s ease;
}
.tech-box[href]:hover {
  border-color: var(--accent);
  color: #fff;
  cursor: pointer;
}
.tech-label {
  display: block;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--accent);
  margin-bottom: 2px;
}
.tech-desc {
  display: block;
  font-size: 9px;
  color: #94a3b8;
}

/* --- Visibility: desktop vs mobile --- */
.desktop-only {
  display: none;
}
#mobile-controls,
#pause-btn,
#info-btn,
#hire-btn,
#credits-modal {
  display: none;
}
#mobile-controls.mobile-visible {
  display: block;
}
#pause-btn.mobile-visible {
  display: flex;
}
#info-btn.mobile-visible {
  display: flex;
}
#hire-btn.mobile-visible {
  display: flex;
}
#credits-modal.mobile-visible {
  display: flex;
}

@media (hover: hover) and (pointer: fine) {
  .desktop-only {
    display: flex;
  }
  #hire-btn {
    display: flex !important;
    position: absolute;
    top: 10px;
    right: 10px;
  }
  #meet-game-btn {
    display: flex !important;
    position: absolute;
    top: 10px;
    right: 110px;
  }
}
@media (hover: none) and (pointer: coarse) {
  .desktop-only {
    display: none !important;
  }
  .legend-panel {
    display: none;
  }
}

/* --- Landscape orientation overlay (mobile/tablet portrait) --- */
#rotate-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 6, 8, 0.95);
  backdrop-filter: blur(8px);
}
.rotate-box {
  text-align: center;
  padding: 30px;
  max-width: 320px;
}
.rotate-icon {
  font-size: 64px;
  margin-bottom: 20px;
  animation: rotateHint 2s ease-in-out infinite;
}
@keyframes rotateHint {
  0%,
  100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(90deg);
  }
}
.rotate-title {
  font-family: var(--font-pixel);
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 12px;
}
.rotate-desc {
  font-size: 14px;
  color: #cbd5e1;
  margin-bottom: 8px;
}
.rotate-hint {
  font-size: 12px;
  color: #64748b;
}

@media (hover: none) and (pointer: coarse) and (orientation: portrait) {
  #rotate-overlay {
    display: flex;
  }
  #game-wrapper {
    filter: blur(4px);
  }
}

/* ── Credits bar ─────────────────────────────────────── */
#game-credits-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  font-family: var(--font-pixel);
  font-size: 7px;
  color: #64748b;
  background: rgba(10, 12, 16, 0.85);
  padding: 6px 12px;
  text-align: center;
  line-height: 1.6;
  backdrop-filter: blur(4px);
  border-top: 1px solid rgba(255, 112, 36, 0.15);
}
#game-credits-bar a {
  color: #94a3b8;
  text-decoration: none;
}
#game-credits-bar a:hover {
  color: var(--accent);
}

/* Loading screen */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}
#loading-screen.loading-done {
  opacity: 0;
  pointer-events: none;
}
.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 40px;
}
.loading-title {
  font-family: var(--font-pixel);
  font-size: clamp(10px, 2.5vw, 18px);
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent-glow);
  text-align: center;
  line-height: 1.8;
  letter-spacing: 0.05em;
  animation: loading-pulse 2s ease-in-out infinite;
}
@keyframes loading-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}
.loading-bar-track {
  width: min(360px, 80vw);
  height: 10px;
  background: rgba(255, 112, 36, 0.15);
  border: 1px solid rgba(255, 112, 36, 0.35);
  border-radius: 2px;
  overflow: hidden;
}
#loading-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  border-radius: 2px;
  transition: width 0.15s ease;
}
.loading-label {
  font-family: var(--font-pixel);
  font-size: clamp(7px, 1.5vw, 10px);
  color: #94a3b8;
  letter-spacing: 0.08em;
}

/* --- Booking modal (game theme) --- */
.cv-modal-hidden {
  display: none !important;
}
.hire-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 9000;
}
.hire-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9001;
}
.hire-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 2px dashed rgba(73, 204, 144, 0.3);
  flex-shrink: 0;
}
.hire-dialog-header h3 {
  margin: 0;
  font-family: var(--font-pixel);
  font-size: 11px;
  color: #49cc90;
}
.hire-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #666;
  line-height: 1;
  padding: 0 4px;
  flex-shrink: 0;
}
.hire-close:hover {
  color: #ccc;
}
.bk-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bk-dialog {
  background: rgba(13, 17, 23, 0.97);
  border: 3px solid #49cc90;
  border-radius: 12px;
  width: 600px;
  max-width: 96vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-ui);
  box-shadow: 0 0 35px rgba(73, 204, 144, 0.25);
  overflow: hidden;
}
.bk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 2px dashed rgba(73, 204, 144, 0.3);
  flex-shrink: 0;
}
.bk-header h3 {
  margin: 0;
  font-family: var(--font-pixel);
  font-size: 11px;
  color: #49cc90;
}
.bk-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #666;
  line-height: 1;
  padding: 0 4px;
}
.bk-close:hover {
  color: #ccc;
}
.bk-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.bk-hidden {
  display: none !important;
}
.bk-steps {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(73, 204, 144, 0.3);
}
.bk-step-dot {
  flex: 1;
  padding: 8px 4px;
  text-align: center;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: #555;
  background: rgba(255, 255, 255, 0.03);
}
.bk-step-dot.active {
  color: #0a0c10;
  background: #49cc90;
}
.bk-step-dot.done {
  color: #49cc90;
  background: rgba(255, 255, 255, 0.03);
}
.bk-state {
  text-align: center;
  padding: 30px 0;
  color: #555;
}
.bk-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.bk-state-icon i {
  color: #555;
}
.bk-state p {
  margin: 0 0 16px;
  font-size: 13px;
  color: #94a3b8;
}
.bk-btn-secondary {
  background: none;
  border: 1px dashed #49cc90;
  color: #49cc90;
  border-radius: 6px;
  padding: 8px 20px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-pixel);
  font-size: 9px;
}
.bk-btn-secondary:hover {
  background: rgba(73, 204, 144, 0.1);
}
.bk-step-label {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: #49cc90;
  margin: 0 0 16px;
}
.bk-badge {
  display: inline-block;
  background: rgba(73, 204, 144, 0.1);
  border: 1px solid #49cc90;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 11px;
  color: #49cc90;
  margin-bottom: 14px;
}
.bk-dates-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.bk-date-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(73, 204, 144, 0.3);
  border-radius: 6px;
  padding: 10px 8px;
  font-size: 12px;
  color: #cbd5e1;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--font-ui);
}
.bk-date-btn:hover {
  border-color: #49cc90;
}
.bk-date-day {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: #e2e8f0;
}
.bk-date-date {
  font-size: 11px;
  color: #94a3b8;
}
.bk-date-count {
  font-size: 10px;
  color: #49cc90;
  font-weight: 500;
}
.bk-back-btn {
  background: none;
  border: none;
  color: #555;
  font-size: 12px;
  cursor: pointer;
  padding: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.bk-back-btn:hover {
  color: #ccc;
}
.bk-slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.bk-slot-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(73, 204, 144, 0.3);
  border-radius: 6px;
  padding: 10px 6px;
  font-size: 13px;
  color: #cbd5e1;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s;
}
.bk-slot-btn:hover {
  border-color: #49cc90;
  color: #49cc90;
}
.bk-field {
  margin-bottom: 14px;
}
.bk-field label {
  display: block;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: #94a3b8;
  margin-bottom: 6px;
}
.bk-field input,
.bk-field textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(73, 204, 144, 0.3);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  color: #e2e8f0;
  font-family: var(--font-ui);
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.bk-field textarea {
  resize: vertical;
  min-height: 60px;
}
.bk-field input:focus,
.bk-field textarea:focus {
  border-color: #49cc90;
  box-shadow: 0 0 8px rgba(73, 204, 144, 0.25);
}
.bk-field input::placeholder,
.bk-field textarea::placeholder {
  color: #475569;
}
.bk-required {
  color: #49cc90;
}
.bk-btn-primary {
  background: #49cc90;
  color: #0a0c10;
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  font-family: var(--font-pixel);
  font-size: 9px;
  cursor: pointer;
  font-weight: 700;
}
.bk-btn-primary:hover {
  filter: brightness(1.1);
}
.bk-btn-primary:disabled {
  opacity: 0.5;
  cursor: default;
}
.bk-step-confirm,
.bk-step-error {
  text-align: center;
  padding: 20px 0;
}
.bk-confirm-check {
  font-size: 40px;
  color: #49cc90;
  margin-bottom: 12px;
}

.bk-step-error .bk-confirm-check {
  color: #ef4444;
}
.bk-confirm-title {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: #49cc90;
  margin: 0 0 12px;
}
.bk-confirm-detail {
  font-size: 13px;
  color: #94a3b8;
  margin: 0 0 16px;
}
.bk-confirm-note {
  font-size: 12px;
  color: #555;
  margin: 0 0 20px;
}

.hire-submit {
  display: block;
  margin: 0 auto;
}

/* Submit button spinner while Turnstile loads */
.hire-submit.is-loading,
.bk-btn-primary.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.hire-submit.is-loading::after,
.bk-btn-primary.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: bk-spin 0.7s linear infinite;
}
