:root {
  --bg-panel: rgba(15, 23, 42, 0.88);
  --bg-panel-solid: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.82);
  --border-subtle: rgba(148, 163, 184, 0.22);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #0ea5e9;
  --success: #34d399;
  --danger: #f87171;
  --radius: 14px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b1120;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
}

/* ==========================================================================
   Úvodní rozcestník prohlídek s PINem (pureplace.cz/prohlidky)
   ========================================================================== */
#catalog-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: radial-gradient(circle at 50% 0%, #1e293b 0%, #0b1120 75%);
  overflow-y: auto;
  padding: 36px 24px 60px;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#catalog-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.catalog-container {
  max-width: 1080px;
  margin: 0 auto;
}

.catalog-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 26px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border-subtle);
}

.catalog-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.catalog-brand-top {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.catalog-brand-sub {
  font-size: 14px;
  color: var(--text-muted);
}

.admin-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 22px;
}

.tour-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.tour-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.45);
}

.tour-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  padding: 4px 10px;
  border-radius: 999px;
  width: fit-content;
  margin-bottom: 10px;
}

.tour-card h3 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.tour-card p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.pin-form {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.pin-form-label {
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 600;
}

.pin-input-row {
  display: flex;
  gap: 8px;
}

.text-input {
  flex: 1;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  transition: border-color 0.15s ease;
}

.text-input:focus {
  border-color: var(--accent);
}

.pin-error {
  font-size: 12px;
  color: var(--danger);
  min-height: 16px;
}

/* Admin editační blok uvnitř karty */
.admin-card-box {
  background: rgba(15, 23, 42, 0.65);
  border: 1px dashed rgba(56, 189, 248, 0.4);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.admin-card-box label {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Modal pro Admin přihlášení */
#admin-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(11, 17, 32, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#admin-modal.hidden {
  display: none;
}

.modal-box {
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   3D Scéna a ovládací lišty
   ========================================================================== */
#canvas-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#canvas-container:active {
  cursor: grabbing;
}

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.65);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

body.pointer-locked #crosshair {
  opacity: 1;
}

#top-bar {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
  z-index: 20;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

body.pointer-locked #top-bar {
  opacity: 0.18;
}

.bar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  padding: 8px 14px;
  border-radius: var(--radius);
  pointer-events: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.brand-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

select, .btn {
  background: rgba(30, 41, 59, 0.92);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 8px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
  white-space: nowrap;
}

select:hover, .btn:hover {
  border-color: var(--accent);
  background: rgba(51, 65, 85, 0.95);
}

.btn-primary {
  background: rgba(14, 165, 233, 0.25);
  border-color: rgba(56, 189, 248, 0.6);
  color: #e0f2fe;
}

.btn-primary:hover {
  background: rgba(14, 165, 233, 0.42);
}

#side-panel {
  position: fixed;
  top: 72px;
  left: 14px;
  width: 310px;
  max-height: calc(100vh - 145px);
  overflow-y: auto;
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 16px;
  z-index: 20;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#side-panel.collapsed {
  transform: translateX(-340px);
  opacity: 0;
  pointer-events: none;
}

body.pointer-locked #side-panel {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-20px);
}

.panel-section {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.panel-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.panel-section.hidden {
  display: none;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 13px;
}

.control-row:last-child {
  margin-bottom: 0;
}

.control-row label {
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.slider-wrap {
  margin-bottom: 10px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 5px;
}

.slider-val {
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.full-width {
  width: 100%;
  text-align: center;
  justify-content: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#bottom-hud {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  color: #e2e8f0;
  z-index: 20;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: opacity 0.25s ease;
}

body.pointer-locked #bottom-hud {
  opacity: 0.45;
}

.key-badge {
  display: inline-block;
  background: rgba(51, 65, 85, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  color: #f8fafc;
  margin: 0 2px;
}

#walk-prompt {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 16px;
  padding: 18px 26px;
  text-align: center;
  z-index: 15;
  cursor: pointer;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#walk-prompt:hover {
  background: rgba(15, 23, 42, 0.95);
  border-color: var(--accent);
  transform: translate(-50%, -50%) scale(1.02);
}

body.pointer-locked #walk-prompt,
#walk-prompt.hidden {
  opacity: 0;
  pointer-events: none;
}

#walk-prompt h2 {
  font-size: 17px;
  margin-bottom: 6px;
  color: #f8fafc;
}

#walk-prompt p {
  font-size: 13px;
  color: var(--text-muted);
}

#loading-overlay,
#drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity 0.25s ease;
}

#loading-overlay.hidden,
#drop-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-box {
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 24px 32px;
  text-align: center;
  min-width: 290px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.progress-track {
  width: 100%;
  height: 7px;
  background: #1e293b;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 12px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.15s ease;
}

#toast {
  position: fixed;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent);
  color: #f8fafc;
  padding: 9px 18px;
  border-radius: 99px;
  font-size: 13px;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#toast.visible {
  opacity: 1;
}

.stats-badge {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
  #bottom-hud {
    display: none;
  }
  #side-panel {
    width: calc(100vw - 28px);
  }
}
