* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
}

button { font: inherit; }

a { color: inherit; }

.top-menu {
  height: 54px;
  padding: 7px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #695529;
  color: #d9c98f;
  background: #100e0b;
}

.brand {
  margin-right: 8px;
  color: #d6b95e;
  font: 600 13px/1 Georgia, serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.top-menu label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #8f805e;
  font: 600 10px/1 Georgia, serif;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.top-menu select {
  min-width: 150px;
  height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid #5f4d27;
  color: #e8dbb3;
  background: #19150f;
}

.top-menu select:disabled { opacity: .55; }

.viewer {
  position: relative;
  width: 100vw;
  height: calc(100vh - 54px);
  overflow: hidden;
  background: #000;
}

#direction-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  opacity: 1;
  transition: opacity 120ms ease;
}

#direction-image.is-changing { opacity: .35; }

.turn {
  position: absolute;
  top: 50%;
  width: 68px;
  height: 68px;
  transform: translateY(-50%);
  border: 1px solid rgba(224, 189, 91, .55);
  border-radius: 50%;
  color: #f2d77d;
  background: rgba(0, 0, 0, .52);
  cursor: pointer;
  opacity: .62;
  transition: opacity 120ms ease, background 120ms ease, transform 120ms ease;
}

.turn span {
  display: block;
  font: 38px/1 Arial, sans-serif;
  transform: translateY(-2px);
}

.turn:hover,
.turn:focus-visible {
  opacity: 1;
  background: rgba(45, 34, 16, .88);
  outline: none;
}

.turn-left { left: 24px; }
.turn-right { right: 24px; }

.move-forward {
  position: absolute;
  top: 8%;
  left: 50%;
  z-index: 3;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 1px solid rgba(224, 189, 91, .55);
  border-radius: 50%;
  color: #f2d77d;
  background: rgba(0, 0, 0, .58);
  cursor: pointer;
  opacity: .68;
  transform: translateX(-50%);
}

.move-forward span { font: 36px/1 Arial, sans-serif; }

.move-forward:hover,
.move-forward:focus-visible {
  opacity: 1;
  background: rgba(45, 34, 16, .88);
  outline: none;
}

.move-back {
  position: absolute;
  left: 50%;
  bottom: 155px;
  z-index: 3;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 1px solid rgba(224, 189, 91, .55);
  border-radius: 50%;
  color: #f2d77d;
  background: rgba(0, 0, 0, .58);
  cursor: pointer;
  opacity: .68;
  transform: translateX(-50%);
}

.move-back span { font: 36px/1 Arial, sans-serif; }

.move-back:hover,
.move-back:focus-visible {
  opacity: 1;
  background: rgba(45, 34, 16, .88);
  outline: none;
}

.map-toggle,
.header-action,
.header-link {
  margin-left: auto;
  padding: 8px 13px;
  border: 1px solid rgba(224, 189, 91, .55);
  color: #e5cf8a;
  background: rgba(0, 0, 0, .58);
  cursor: pointer;
  font: 600 11px/1.2 Georgia, serif;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .72;
}

.header-action,
.header-link { margin-left: 0; }

.header-link {
  text-decoration: none;
  white-space: nowrap;
}

.map-toggle:hover,
.map-toggle:focus-visible,
.header-action:hover,
.header-action:focus-visible,
.header-link:hover,
.header-link:focus-visible { opacity: 1; outline: none; }

.tag-panel {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 6;
  width: min(850px, calc(100vw - 36px));
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  border: 1px solid rgba(224, 189, 91, .6);
  color: #d9c98f;
  background: rgba(8, 7, 5, .94);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .65);
}

.tag-spawn-preview {
  order: 10;
  width: 100%;
  flex: 1 0 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

.tag-spawn-preview[hidden] { display: none; }

.tag-spawn-preview-image {
  position: relative;
  width: 220px;
  height: 124px;
  flex: 0 0 220px;
  overflow: hidden;
  border: 1px solid #5f4d27;
  background: #000;
}

.tag-spawn-preview-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

#tag-spawn-preview-marker {
  position: absolute;
  width: 13px;
  height: 13px;
  border: 2px solid #f2d77d;
  border-radius: 50%;
  background: rgba(0, 0, 0, .38);
  box-shadow: 0 0 0 3px rgba(242, 215, 125, .18);
  transform: translate(-50%, -50%);
}

#tag-spawn-preview-label {
  overflow: hidden;
  min-width: 0;
  color: #d8c17a;
  font: 10px/1.35 Georgia, serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-panel[hidden] { display: none; }

.tag-panel label {
  min-width: 0;
  display: grid;
  gap: 5px;
  flex: 1 1 150px;
  color: #8f805e;
  font: 600 9px/1 Georgia, serif;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.tag-panel select,
.tag-panel input,
.tag-panel button {
  height: 34px;
  border: 1px solid #5f4d27;
  color: #e8dbb3;
  background: #19150f;
}

.tag-panel input { padding: 0 9px; }

.tag-panel .tag-name-field { flex-basis: 210px; }

.tag-panel .danger-action {
  border-color: #754239;
  color: #dca89c;
}

.tag-panel .danger-action:disabled,
#tag-save-label:disabled {
  cursor: not-allowed;
  opacity: .4;
}

.tag-panel button { padding: 0 10px; cursor: pointer; }

.tag-panel button.is-armed {
  border-color: #d6b95e;
  color: #fff2bd;
  background: #3a2b11;
}

.tag-panel #tag-instruction {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  padding: 6px 9px;
  color: #d8c17a;
  background: rgba(0, 0, 0, .82);
  font: 10px/1.2 Georgia, serif;
}

.viewer.is-tagging #direction-image { cursor: crosshair; }

.map-reference {
  position: absolute;
  top: 14px;
  left: 18px;
  z-index: 2;
  width: min(260px, 32vw);
  padding: 7px;
  border: 1px solid rgba(224, 189, 91, .6);
  background: rgba(0, 0, 0, .82);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .65);
}

.map-reference img {
  width: 100%;
  display: block;
}

.map-reference span {
  display: block;
  padding: 7px 3px 2px;
  color: #d8c17a;
  text-align: center;
  font: 600 11px/1.2 Georgia, serif;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.object-tray {
  position: absolute;
  left: 50%;
  bottom: 15px;
  z-index: 3;
  width: min(820px, calc(100vw - 210px));
  min-height: 42px;
  padding: 6px 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(224, 189, 91, .42);
  color: #d9c98f;
  background: rgba(8, 7, 5, .82);
  transform: translateX(-50%);
  backdrop-filter: blur(5px);
}

.object-tray-label {
  color: #8f805e;
  font: 600 9px/1 Georgia, serif;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.object-list {
  min-width: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.object-chip {
  flex: 0 0 auto;
  padding: 7px 9px;
  border: 1px solid rgba(224, 189, 91, .38);
  color: #e8dbb3;
  background: #19150f;
  cursor: pointer;
  font: 600 10px/1 Georgia, serif;
  letter-spacing: .05em;
}

.object-chip:hover,
.object-chip:focus-visible,
.object-chip.is-active {
  border-color: #d6b95e;
  color: #fff2bd;
  outline: none;
}

.object-status {
  margin-left: auto;
  color: #a89565;
  font: 10px/1.2 Georgia, serif;
  white-space: nowrap;
}

.object-empty {
  color: #75694e;
  font: 10px/1 Georgia, serif;
}

.object-markers {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.object-marker {
  position: absolute;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid #f0ce65;
  border-radius: 50%;
  background: rgba(214, 185, 94, .16);
  box-shadow: 0 0 0 7px rgba(214, 185, 94, .11), 0 0 22px rgba(240, 206, 101, .65);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: marker-pulse 1.35s ease-in-out infinite alternate;
}

.object-marker.is-active {
  width: 42px;
  height: 42px;
  border-width: 3px;
  box-shadow: 0 0 0 9px rgba(214, 185, 94, .16), 0 0 30px rgba(255, 224, 119, .9);
}

@keyframes marker-pulse {
  from { opacity: .58; }
  to { opacity: 1; }
}

[hidden] { display: none !important; }

@media (max-width: 640px) {
  .top-menu { height: 96px; flex-wrap: wrap; gap: 6px 10px; }
  .brand { width: 100%; }
  .top-menu label span { display: none; }
  .top-menu select { min-width: 128px; max-width: 38vw; }
  .viewer { height: calc(100vh - 96px); }
  .map-toggle { padding: 8px; }
  .turn { width: 54px; height: 54px; }
  .turn span { font-size: 30px; }
  .turn-left { left: 12px; }
  .turn-right { right: 12px; }
  .map-reference { top: 10px; left: 10px; width: min(220px, 54vw); }
  .tag-panel { left: 10px; right: 10px; width: auto; }
  .tag-spawn-preview-image { width: 160px; height: 90px; flex-basis: 160px; }
  .object-tray { bottom: 8px; width: calc(100vw - 132px); }
  .object-status { display: none; }
}
